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

How can I make a drop down list of links using <select>?

Linking

How can I make a drop down list of links using <select>?

by  RISTMO  Posted    (Edited  )
There are two ways to make a list of links using the <select> tag. Here they are:

This will make the links in a drop-down form:

<script>
<!--
function goto(choose){
var selected=choose.options[choose.selectedIndex].value;
if(selected != ""){
location.href=selected;
}
}
//-->
</script>
<SELECT onChange="goto(this);">
<option value="">--Jump to a page--</option>
<option value="page1.html">Page 1</option>
<option value="page2.html">Page 2</option>
<option value="page3.html">Page 3</option>
</SELECT>



This example will make the links in list form:
<script>
<!--
function goto(choose){
var selected=choose.options[choose.selectedIndex].value;
if(selected != ""){
location.href=selected;
}
}
//-->
</script>
<SELECT onChange="goto(this);">
<option value="">--Jump to a page--</option>
<option value="page1.html">Page 1</option>
<option value="page2.html">Page 2</option>
<option value="page3.html">Page 3</option>
</SELECT>

Rick Morgan
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top