...

View Full Version : Resolved Trying to work out how to populate a drop down list?



DanielHowden
11-13-2010, 06:42 PM
I have a drop down list that I want to populate with items that are dependent on the selection of the first drop down list.

I can't figure out how to do this, has anyone on here done this before?

Cheers Dan

Excavator
11-13-2010, 07:03 PM
Hello DanielHowden,
If you already have a dropdown working it must have menu items already. Just replace them with your own.

Not much we can tell you without having a look at your code. I'm sure most people here have done a dropdown menu, they can be very difficult for a new coder.

Post your code here and let us have a look. Even better, link us to the test site.

DanielHowden
11-13-2010, 07:15 PM
Heres the code, I only didn't show it as I haven't got very far, just can't figure out how to do it!

Cheers Dan.



<HTML><HEAD>

</HEAD>

<BODY>&nbsp;

<select id=Items >
<option value=01 selected>Opt1</option>
<option value=02>Opt2</option>
<option value=03>Opt3</option>
<option value=04>Opt4</option>
</select>

<select id=SecItems>
<option selected></option>
</select>

</BODY></HTML>

Excavator
11-13-2010, 07:42 PM
I beleive options like that are an element of forms. I mistook your question to be about a menu, like navigation for a website.

Are you following a tutorial to do this?

DanielHowden
11-13-2010, 07:45 PM
No, I just teach myself and learn by mistakes. While I have done a lot of coding I am new to HTML. I am guessing that maybe I will have to run some kind of script to do this.

Cheers Dan.

Excavator
11-13-2010, 07:58 PM
That's a good way to learn, jsut dive in and do it. A good tutorial can help a lot too, google can probably help you with that.

One thing to note, your document should have a valid DocType. I don't know if it does and you just didn't quote it here with your code...
Have a look at the link about DocTypes in my signature line.

Excavator
11-13-2010, 08:02 PM
An example of what you're attempting - http://www.java2s.com/Code/JavaScriptDemo/LinkedComboBoxoptionCountryprovince.htm

DanielHowden
11-14-2010, 10:05 AM
That is great, just what I was wanting to do.

Cheers Dan.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum