A selection menu can also be used to select an URL using either a CGI script ( like jump.cgi in top example) or a javascript function (see switchURL used in jswitch2.htm example). More elegant, but 'ruder' is to put the javascript within the select as an onChange for an immdediate jump, as in the third example. |
|
<FORM method=get action="jump.cgi">
<select size=2 name="goto">
<option value="webfolio.htm">Goldray Webfolio
<option value="dclocal.htm">DC Local Pages
<option value="http://cws.iworld.com">Winsock Software
</select><input type="submit" value="GO!"></FORM>
|
|
<FORM NAME="f1">
<SELECT size=3 NAME="pages">
<OPTION value="topone.htm">Top Choice
<OPTION value="second.htm">Next Choice
<OPTION value="third.htm">Last Choice
</SELECT>
<INPUT TYPE="button" VALUE="Switch" onClick="switchURL(f1)">
</FORM>
|
These two approaches can be reversed. That is, the onChange of the last could have called the function and the onClick of the first could have specified the code. |
|
<FORM>
<SELECT size=3 NAME="menu" onChange="location.href=
this.form.menu.options[this.form.menu.selectedIndex].value">
<OPTION value="topone.htm">Top Choice2
<OPTION value="second.htm">Next Choice2
<OPTION value="third.htm">Last Choice2
</SELECT>
</FORM>
|