Hello,
Please suffer a fool for a moment…
I’m just learning javascript and I’m having a difficult time setting up a page with multiple drop down menus that will be used for navigation. I need four drop downs on the page, each with links to different pages. The dropdowns will be used to group like links together. The problem is that after struggle to create the code myself I have resorted to cutting and pasting code from this site. The first dropdown will work, but every other dropdown fails, with an error of “xxx is undefined object or null.”
Here is the code I’m attempting to use:
<!– Begin
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
// End –>
</SCRIPT>
</HEAD>
and later in the body:
<center>
<form name=”form”>
<select name=”site” size=1>
<option value=””>About the Library
<option value=”http://www.yahoo.com”>Yahoo
<option value=”http://www.metacrawler.com”>Metacrawler
<option value=”http://www.altavista.digital.com”>Altavista
<option value=”http://www.webcrawler.com”>Webcrawler
<option value=”http://www.lycos.com”>Lycos
<option value=”http://javascript.internet.com”>JavaScript Source
</select>
<input type=button value=”Select” onClick=”javascript:formHandler(this)”>
</form>
</center>
Note: The links provided above are the basic links that the original code I copied contained. The finished product is for a library, and will link to pages at the library site, sorted by genre.
Any idea what I am doing wrong here?
Any help would be appreciated, and earn you 100 karma points ?
Jeff