JavaScript Implementation
The main function that does
the hard work is as follows:
<SCRIPT LANGUAGE="JavaScript">
<!--
function menu_goto( menuform )
{
// see http://www.thefreecountry.com/articles/javascriptmenu.html
// for an explanation of this script and how to use it on your
// own site
selecteditem = menuform.newurl.selectedIndex ;
newurl = menuform.newurl.options[ selecteditem ].value ;
if (newurl.length != 0) {
location.href = newurl ;
}
}
//-->
</SCRIPT>
Put in in the <HEAD> section of your web page or, if you
prefer, just before the drop down menu code (see below).
The
function takes a single argument - the form object. It then proceeds
to extract the selected value from the object and load the browser
from that URL.
If your site is designed with frames, you
will need to use "top.location.href" instead of "location.href" if
you want the new document to replace your all your frames (such as
when you have a URL that leaves your website). You can leave it as
it is if you want the document to appear in the current frame.
Alternatively, if you want it to be in another frame (sibling of the
one in which the menu appears), just replace "location.href" with
"parent.your_frame.location.href" where "your_frame" is the frame
named "your_frame".
Now for the menu itself. Since the exact
URLs for your menu and the items will differ for your site, you
should modify the code given below for your situation.
<form name="menuform">
<select name="newurl" onchange="menu_goto(this.form)">
<option value="">----- Select A Page -----
<option value="index.html">Home
<option value="feedback.html">Feedback
<option value=""> ---- Other Good Sites ----
<option value="http://www.thefreecountry.com/">thefreecountry.com
</select>
<input type=submit value="Go!" onclick="menu_goto(this.form)">
</form>
Next Step: Implementing the Javascript: Step 2b >>