Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown question

Status
Not open for further replies.

mbaddar

Programmer
May 10, 2001
120
US
Hi,

I'm pretty rusty on my javascript (actually all web languages) and I'm trying to figure out if something I need to do can be done in javascript or asp. Basically, I have one dropdown with ten different states. I have another dropdown on the same page. The second dropdown should be dynamically populated with different values depending on what value is chosen in the first dropdown (for example, if CA is chosen in state dropdown the second dropdown should have different values than if MA is chosen in state dropdown). These fields are not stored in any tables (they are just for the purposes of search criteria).

Basically, my question is if dynamically populating this second dropdown with different text values is possible in javascript (and, if so, can someone point me in the right direction for how to go about this).

Thanks,
MBaddar
 
>> is possible in javascript

yes it is

>> point me in the right direction

in DHTML the SELECT object has a &quot;options&quot; collection which is the collection of all the child <OPTION> elements. You can change the collection using the methods of the options object.

for details on these objects you can look on msdn.microsoft.com at the HTML Element Reference.

or for the hardcore version see
-pete
 
Hi Pete,

That rings a bell. Thank you very much.

Thanks,
Mbaddar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top