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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT case

Status
Not open for further replies.

TheCandyman

Technical User
Sep 9, 2002
761
US
If i have a select like below, when a page is loaded and i have a variable, how can i make the dropdown start on option 2 or 3, not default 1??


<SELECT class=saveHistory id=m1 name=m1>
<option>Select Choice</option>
<option value=&quot;OPvalue&quot;>Operator Stations</option>
<option value=&quot;UNvalue&quot;>Universal Stations</option>
</SELECT>
 
Hi,

You will want to put the word &quot;SELECTED&quot; into one of the <OPTION> tags for it to show a different selection rather than the first. You will want to use which ever programming language you use to determine that and which option should be selected.

Hope this helps!

Nate

mainframe.gif

 
Use the SELECTED attribute in the OPTION tags. To have the second item in the SELECT list display automatically, the code would look like so:

<SELECT class=saveHistory id=m1 name=m1>
<option>Select Choice</option>
<option value=&quot;OPvalue&quot; SELECTED>Operator Stations</option>
<option value=&quot;UNvalue&quot;>Universal Stations</option>
</SELECT>

For the third option:

<SELECT class=saveHistory id=m1 name=m1>
<option>Select Choice</option>
<option value=&quot;OPvalue&quot;>Operator Stations</option>
<option value=&quot;UNvalue&quot; SELECTED>Universal Stations</option>
</SELECT>

Etc, etc.

HTH,
jp
 
THE MAN!!!

///

THE MEN!!!

cuz if they are THE MAN then well....:/

sometime you just gotta say &quot;WHAT THE @#*% !!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top