PDA

View Full Version : drop down menu


pescort
10-21-2002, 08:03 PM
I have a drop down menu which links visitors to different pages throughout my site. However, after you use the menu to go to another page and you hit the back button, the choice is still highlighted and you are unable to choose the same option. How can I have the default option displayed each time the page is loaded? Thanks for your help!

beetle
10-21-2002, 08:26 PM
Could it be this simple?

<select onChange="doSomething()">
<option value="blah" selected="true">blah</option>
<option value="blah">blah</option>
<option value="blah">blah</option>
<option value="blah">blah</option>
<option value="blah">blah</option>
</select>

Untested...let me know..

cg9com
10-21-2002, 09:23 PM
i always just used <option selected>

both work

pescort
10-21-2002, 09:25 PM
unfortunately, neither suggestion is working...

beetle
10-21-2002, 09:25 PM
Originally posted by cg9com
i always just used <option selected>

both work Unless you want to move foward with XHTML, in which only selected="selected" and selected="true" are valid.

beetle
10-21-2002, 09:26 PM
<body onLoad="document.formName.selectName.selectedIndex=0;">

pescort
10-21-2002, 09:30 PM
I already have an onLoad function being called. What would I need to do to add another?

beetle
10-21-2002, 09:51 PM
Something important to know about ECMAscript (read: javascript)

New script lines are generated by a line-break within <script> tags. The semicolon is acutally unecessary. The only time it is required is when you have multiple commands on the same line. This includes script within events. So, to include 'two' scripts into an onLoad event, just separate them with a semicolon

onLoad="action1;action2;"

So, in theory, you could have a unlimited amout of code in any event. In practice, however, this is rarely beneficial, or used for that matter.

Capiche?

cg9com
10-21-2002, 10:09 PM
Originally posted by beetle
Unless you want to move foward with XHTML, in which only selected="selected" and selected="true" are valid.

i had a feeling someone was going to say that lol
but at least now i know :)