•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,558 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,739 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 770 | Replies: 1
![]() |
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 0
I've been doing PHP for a while and am starting up on Javascript. Here is what I'd like to do:
I need to set up a series of dropdowns. I'd like the first one to be the only one in existence at first. Then, depending on what is selected, I'd like to create the second one and populate it based on what was selected in the first one etc. What is the best way to do this? I assume an OnChange event would be used to trigger a function that creates the new dropdown. How do you actually create a dropdown using JS?
I need to set up a series of dropdowns. I'd like the first one to be the only one in existence at first. Then, depending on what is selected, I'd like to create the second one and populate it based on what was selected in the first one etc. What is the best way to do this? I assume an OnChange event would be used to trigger a function that creates the new dropdown. How do you actually create a dropdown using JS?
Look into the document.createElement() function which creates new DOM elements based on the passed parameter. Also look into the DOM select and DOM option objects.
"I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Dropdowns close when cursor over link underneath (DaniWeb Community Feedback)
- Drop down menus and internal link building (Search Engine Optimization)
- In need of Menu over Frames (JavaScript / DHTML / AJAX)
- instant calculcated quote form (PHP)
- Safe Menu's ? (HTML and CSS)
- Unanswered threads (DaniWeb Community Feedback)
- Messenger webcam prob also Japanese XP internet stopped working (Web Browsers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Hide/display Form Elements Using Js And Dom
- Next Thread: Problem in Ajax



Linear Mode