gcapp
03-30-2004, 05:34 PM
I have the following javascript for a drop down menu:
-------------------------------------------------------------------------
<form name="fedagency" >
<select name="agency" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.fedagency.agency.selectedIndex)">
<option selected value="http://www.usda.gov/" target="newwin">Department of Agriculture </option>
<option selected value="http://www.state.gov/" target="newwin">Department of State </option>
</select>
<input type="button" value="Go"
onClick="jumptolink(document.fedagency.agency.selectedIndex)"><br>
<span id="descriptions" align="left" style="font:italic 13px Arial">
</span>
</form>
<script>
function jumptolink(what){
var selectedopt=document.fedagency.agency.options[what]
if (document.getElementById && selectedopt.getAttribute("target")=="newwin")
window.open(selectedopt.value)
else
window.location=selectedopt.value
}
document.fedagency.agency.options[0].selected=true
--------------------------------------------------------------------------
I would like to display two of these on my page - what do I need to change in the code so the page will recognize two different drop-down menus??
I've tried changing a few things but it causes both menus to not work right.
Help
-------------------------------------------------------------------------
<form name="fedagency" >
<select name="agency" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.fedagency.agency.selectedIndex)">
<option selected value="http://www.usda.gov/" target="newwin">Department of Agriculture </option>
<option selected value="http://www.state.gov/" target="newwin">Department of State </option>
</select>
<input type="button" value="Go"
onClick="jumptolink(document.fedagency.agency.selectedIndex)"><br>
<span id="descriptions" align="left" style="font:italic 13px Arial">
</span>
</form>
<script>
function jumptolink(what){
var selectedopt=document.fedagency.agency.options[what]
if (document.getElementById && selectedopt.getAttribute("target")=="newwin")
window.open(selectedopt.value)
else
window.location=selectedopt.value
}
document.fedagency.agency.options[0].selected=true
--------------------------------------------------------------------------
I would like to display two of these on my page - what do I need to change in the code so the page will recognize two different drop-down menus??
I've tried changing a few things but it causes both menus to not work right.
Help