...

View Full Version : This works only once in Netscape 4.7/8, why?



tcrabtree21
07-01-2004, 02:06 PM
I've got a simple pull-down menu to help visitors navigate department pages. It works in Mozilla, Firefox, Netscape 7.x (all the Geckos), IE 5,5.5,6, etc., but in Netscape 4.7/8, the menu works once, but if you hit the "back" button and return to the page, the menu no longer functions.

I've tried rewriting the code but nothing has worked. One thing, the <div></div> section is a necessary part of the code and I can't remove it, else something else breaks. If anyone can help me, I'd be very grateful. Thanks.


Here is the code:

---IN <BODY> of document
<div id=formdiv1 name=formdiv1 style="position:relative">
<form name="adminform">
<select name="select" onChange="MM_jumpMenu('parent',this,0)">
<option selected>Education Directory</option>
<option>--------------------------</option>
<option value="/about.html">About Education Department</option>
<option value="/calendar.html">Education Calendar 2004-05</option>
<option value="/academics.html">Academics</option>
<option value="/faculty.html">Education Faculty</option>
</select>
</form>
</div>


--In <HEAD> of document

<script language="javascript" type="text/javascript">

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

</script>

jbot
07-01-2004, 02:18 PM
it doesn't work because it's dunceweaver code (no offence, like).

here's a better example:


---IN <BODY> of document
<div id=formdiv1 name=formdiv1 style="position:relative">
<form name="adminform">
<select name="select" onChange="myJumpMenu(window.parent,this)">
<option selected>Education Directory</option>
<option>--------------------------</option>
<option value="/about.html">About Education Department</option>
<option value="/calendar.html">Education Calendar 2004-05</option>
<option value="/academics.html">Academics</option>
<option value="/faculty.html">Education Faculty</option>
</select>
</form>
</div>


--In <HEAD> of document
<script language="javascript" type="text/javascript">

function myJumpMenu(oTrg,oSrc)
{
oTrg.location = oSrc.options[oSrc.selectedIndex].value;
oSrc.selectedIndex = 0;
}

</script>

hope that helps :D

tcrabtree21
07-01-2004, 02:33 PM
Thanks for the reply. I used the Dreamweaver code as a last resort. I'd previously tried quite a few other methods, but with no success.

Your code seems to work, even when hitting the back button and returning to the page, the menu still works. I am curious why 'this' works, but explicitly referencing
'document.forms.adminform.options[document.forms.adminform.options.selectedIndex].value'
does not work more than once in Netscape 4.x.

I'd tried that method before posting to the forum. Anyway, I appreciate the quick response. Thanks again



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum