Assignment 27: A Possible Answer


<SCRIPT LANGUAGE="javascript">
function LinkUp()
var number = document.DropDown.DDlinks.selectedIndex;
location.href = document.DropDown.DDlinks.options[number].value;


<FORM NAME="DropDown">
<OPTION SELECTED VALUE="assignment27.html">On Site Links
<OPTION VALUE="page.html" > Page One
<OPTION VALUE="page2.html"> Page Two
<OPTION VALUE="page3.html"> Page Three
<INPUT TYPE="BUTTON" VALUE="Click to Go!" onClick="LinkUp()">

<SCRIPT LANGUAGE="javascript">
function LinkUp2()
var number2 = document.DropDown2.DDlinks2.selectedIndex;
location.href = document.DropDown2.DDlinks2.options[number2].value;


<FORM NAME="DropDown2">
<SELECT NAME="DDlinks2">
<OPTION SELECTED VALUE="assignment27.html">Off Site Links
<OPTION VALUE="https://www.htmlgoodies.com"> HTML Goodies
<OPTION VALUE="http://www.developer.com"> Developer.com
<OPTION VALUE="http://www.earthweb.com"> EarthWeb
<INPUT TYPE="BUTTON" VALUE="Click to Go!" onClick="LinkUp2()">


Gives you this:

     There's a lot of code up in there. The way I did it was to simply copy the original code, change out the local link VALUEs with off-site values, and update all the names and variable names. By "update" I mean I added the number 2 to each one.

     Remember, this is a whole new script and it cannot have the same variables or form item names as the original or you'll get errors galore.


Did You Get It?


Back to the Index Page