Click to See Complete Forum and Search --> : drop down menu frustration


gnorth
12-26-2002, 04:50 PM
Help! I'm working with a drop down menu on a site that I'm working on, but I am not able to get the menu to reset itself after a selection is made. Can someone please provide assistance and save my brain!

Here is my code:

<head>
<SCRIPT Language="JavaScript">
<!--
function loadPage(pageURL){
location.href = pageURL.options[pageURL.selectedIndex].value
}
//-->
</SCRIPT>
</head>

<body>
<FORM>
<FONT SIZE=4>
<SELECT NAME="selectMenu" onChange="loadPage(this)">
<option value=" ">Quick Jump...</option>
<option value="001.htm">Link 1</option>
<option value="002.htm">Link 2</option>
<option value="003.htm">Link 3</option>
</SELECT>
</FONT>
</FORM>

If there is an eaiser way, please let me know.

Thank you,

Gerald North

swon
12-26-2002, 05:08 PM
your dropdown has an location href to another site, why want you to reset itself?

AdamBrill
12-26-2002, 05:39 PM
I'm not exactly sure what you want. Try this:


<HTML>
<head>
<SCRIPT Language="JavaScript">
<!--
function loadPage(pageURL){
window.open(pageURL.options[pageURL.selectedIndex].value);
pageURL.value="reset"
}
//-->
</SCRIPT>
</head>

<body>
<FORM>
<FONT SIZE=4>
<SELECT NAME=selectMenu onChange="loadPage(this)">
<option value="reset">Quick Jump...</option>
<option value="001.htm">Link 1</option>
<option value="002.htm">Link 2</option>
<option value="003.htm">Link 3</option>
</SELECT>
</FONT>
</FORM>

</HTML>


This opens a new window with the page that you sent it to in it. Then, it puts the drop down menu to what it originally was. If that is not what you want, please be a little more specific about what you do want. Note that I renamed your starting option to reset.

gnorth
12-27-2002, 08:13 AM
Sorry everyone for the confusion. Let me clarify what I need. I want the user to be able to select a menu item and take them to the that page but if they hit the back button the drop down menu still has the page selected. I want it to the item "Main Menu". Does that make sense? I'm not locked into the code I'm using. If someone has an easier way, I'm all for it.

swon
12-27-2002, 08:20 AM
Aha, ok replace the select tag with this one:

<SELECT NAME="selectMenu" onChange="loadPage(this);this.selectedIndex='0'">