Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown list defaults to 1st option...

Status
Not open for further replies.

ringd

Programmer
Jul 11, 2000
35
GB
Hello!

Started JS coding 3 hours ago! Doing ok except for a small niggly problem...

The html page is built as a frameset - header along the top, menu on the left, mainarea on the right.

I have the following JS code within the head tags of the menu page...
<code>
<script language=javascript>
function menujump()
{
parent.mainarea.location.href=document.nav.menuList[document.nav.menuList.selectedIndex].value;}
</script>
</code>

A little later comes the following HTML...
<code>
<select name=&quot;menuList&quot; id=&quot;&quot;>
<option value=&quot;test1.html&quot;>Option 1</option>
<option value=&quot;test2.html&quot;>Option 2</option>
<option value=&quot;test3.html&quot;>Option 3</option>
</select>
</code>

Even later in the HTML comes the following...
<code>
<input type=&quot;image&quot; src=&quot;images/buttons/gobutton.gif&quot; alt=&quot;Go&quot; border=0 onclick=&quot;menujump()&quot;>
</code>

Everything functions fine. The page displayed in the 'mainarea' frame changes to whatever page has been selected from the dropdown list. The problem is that the item shown in the drop down list always reverts back to the first one.

How can I get the selected element to stay visible? Tried various things but can't find a way to do it.

Anyone have any ideas?

Cheers,
Dave.
mailto:dave.ring@barclays.co.uk
 
it should not, try this:
function menujump()
{
parent.mainarea.location.href=document.nav.menuList.options[document.nav.menuList.selectedIndex].value;}


Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top