Pellowe, Code Handout, page 4

1.2 Standart JavaScript Pull down menu

Code from the pull-down menu page
http://www2.gol.com/users/billp/course/ch1p21.html

There are three important parts, shown in 1.2.1 - 1.2.3 below.

1.2.1 This goes in your <head> section:

<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from old browsers
function Go_Dest(form)
{ var
http=''+form.destinations
[form.destinations.selectedIndex].value;
top.location.href=http; return;}
// --End of JavaScript code ----->
</SCRIPT>

1.2.2 This goes right under your <body> statement:

<FORM METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">

1.2.3 This is the pull-down menu code which appears later in your page:

<SELECT NAME="destinations">
<OPTION VALUE="ch1p21no.html">Choose a video:</OPTION>
<OPTION VALUE="ch1p22bu.html">A Bug's Life</OPTION>
<OPTION VALUE="ch1p22ki.html">Kiki's Delivery Service</OPTION>
<OPTION VALUE="ch1p22ti.html">Titanic</OPTION>
<OPTION VALUE="ch1p22to.html">Totoro</OPTION>
</SELECT>
<INPUT TYPE="Button" VALUE="Go" onClick="Go_Dest(this.form)">

The "value" of each option is the URL of the web page you'll go to if you select that option and click the "Go" button. Note that the first option ("Choose a video") has a value, too. Here's why: If a student simply clicks blindly on this menu's "Go" button without making a selection, that student will arrive at a page which explains the error (ch1p21no.html). See "Prevent student confusion and blind clicking" on the next page (section 1.3.2) for further explanation.