[Home]Dropdown menu

HomePage | RecentChanges | Preferences | Newbie Help

[Category JavaScript FAQ]?

Here's one that allows for the possibility that the visitor does not have JavaScript enabled--

<script language="javascript"><!--
document.write('<form onsubmit="location.href='+
  'this.sel.options[this.sel.selectedIndex].value;return false">'+
  '<select name="sel">'+
  '<option value="http://www.link1.com">Link 1'+
  '<option value="http://www.link2.com">Link 2'+
  '<option value="http://www.link3.com">Link 3'+
  '<option value="http://www.link4.com">Link 4'+
  '</select><input type="submit" value="Go"></form>');
// --></script>
<noscript>
   <a href="http://www.link1.com">Link 1</a><br>
   <a href="http://www.link2.com">Link 2</a><br>
   <a href="http://www.link3.com">Link 3</a><br>
   <a href="http://www.link4.com">Link 4</a><br>
</noscript>

chan555


Here's one that doesn't need a "Go" button. Note, however, that this version requires JavaScript:
<form action="" method=post><select name="" onChange="top.location.href = this.option[this.selectedIndex].value;">
<option value="index.htm">Public Access:</option>
<option value="cases.htm">Case Studies</option>
<option value="biblio.htm">Bibliography</option>
<option value="appnotes.htm">Application Notes</option>
<option value="vendors.htm">Vendor Links</option>
<option value="ptrain.htm">Training, Education</option>
</select></form>

See also http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm
Jukka Korpela on tinkering with forms to make menus --http://www.cs.tut.fi/~jkorpela/forms/navmenu.html
Comments --
HomePage | RecentChanges | Preferences | Newbie Help
This page is read-only | View other revisions
Last edited November 12, 2001 5:38 pm (diff)
Search:

This FAQ is happily hosted by Betadome Digital Media