PDA

View Full Version : Drop down menus


kh0513
August 10th, 2005, 10:43 PM
I am wondering how I can add (2) drop down menus on the same line and they both work? I have tried this and one of them doesn't work. Can anyone help my figure this out? Thanks in advance. Kevin

Below is an example of my problem.

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function formHandler(form){

var URL = document.form.site.options[document.form.site.selectedIndex].value;

window.location.href = URL;

}

// End -->

</SCRIPT>

<head>

<meta name="GENERATOR" content="Microsoft FrontPage 4.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

</head>

<center>

<form name="form">

<p><select name="site" size="1" onchange="javascript:formHandler()">

<option value>-------------Go to--------------

<option value="http://www.geocities.com/anywhere/index.html">Home

<option value="http://www.geocities.com/anywhere/standings.html">Standings

<option value="http://www.geocities.com/anywhere/tournaments.html">Tournaments

<option value="http://www.geocities.com/anywhere/thumbnails.html">Photos

<option value="http://www.geocities.com/anywhere/tournament_results.html">Tournaments

Results

<option value="http://www.geocities.com/anywhere/Past_tourny_results.html">Previous

Tournaments

<option value="http://www.geocities.com/anywhere/historyandnotes.html">History

&amp;Notes

<option value="http://www.geocities.com/anywhere/upcomingevents.html">Up

Coming Events

<option value="http://www.geocities.com/anywhere/links.html">Links

</select><select name="D1" size="1" onchange="javascript:formHandler()">

<option value>-------------Go to--------------

<option value="http://www.geocities.com/anywhere2/index.html">Home

<option value="http://www.geocities.com/anywhere2/standings.html">Standings

<option value="http://www.geocities.com/anywhere2/tournaments.html">Tournaments

<option value="http://www.geocities.com/anywhere2/thumbnails.html">Photos

<option value="http://www.geocities.com/anywhere2/tournament_results.html">Tournaments

Results

<option value="http://www.geocities.com/anywhere2/Past_tourny_results.html">Previous

Tournaments

<option value="http://www.geocities.com/anywhere2/historyandnotes.html">History

&amp;Notes

<option value="http://www.geocities.com/anywhere/upcomingevents.html">Up

Coming Events

<option value="http://www.geocities.com/anywhere2/links.html">Links

</select></p>

</form>

</center>

m_casey
August 23rd, 2005, 08:13 AM
You need two different functions and two uniquely named select tags. The script below should resolve your problem:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function formHandler(form){

var URL = document.form.site.options[document.form.site.selectedIndex].value;

window.location.href = URL;

}

function formHandler2(form){

var URL = document.form.site2.options[document.form.site2.selectedIndex].value;

window.location.href = URL;

}

// End -->

</SCRIPT>

<center><p>
<form name="form">

<select name="site" size="1" onchange="javascript:formHandler()">
<option value>-------------Go to--------------
<option value="http://www.geocities.com/anywhere/index.html">Home
<option value="http://www.geocities.com/anywhere/standings.html">Standings
<option value="http://www.geocities.com/anywhere/tournaments.html">Tournaments
<option value="http://www.geocities.com/anywhere/thumbnails.html">Photos
<option value="http://www.geocities.com/anywhere/tournament_results.html">Tournaments Results
<option value="http://www.geocities.com/anywhere/Past_tourny_results.html">Previous Tournaments
<option value="http://www.geocities.com/anywhere/historyandnotes.html">History &amp; Notes
<option value="http://www.geocities.com/anywhere/upcomingevents.html">Up Coming Events
<option value="http://www.geocities.com/anywhere/links.html">Links
</select>

<select name="site2" size="1" onchange="javascript:formHandler2()">
<option value>-------------Go to--------------
<option value="http://www.geocities.com/anywhere2/index.html">Home
<option value="http://www.geocities.com/anywhere2/standings.html">Standings
<option value="http://www.geocities.com/anywhere2/tournaments.html">Tournaments
<option value="http://www.geocities.com/anywhere2/thumbnails.html">Photos
<option value="http://www.geocities.com/anywhere2/tournament_results.html">Tournaments Results
<option value="http://www.geocities.com/anywhere2/Past_tourny_results.html">Previous Tournaments
<option value="http://www.geocities.com/anywhere2/historyandnotes.html">History &amp; Notes
<option value="http://www.geocities.com/anywhere/upcomingevents.html">Up Coming Events
<option value="http://www.geocities.com/anywhere2/links.html">Links
</select></p>
</form>
</center>