...

View Full Version : Jump Menu Script Problem



Ocium
07-19-2007, 12:45 AM
Hi,

I am having a problem with getting jump menus to reset themselves to the <option selected> value.

Here is the code format I am using:

<tr>
<form name="dammit">
<td>
<select name="dammit1" onChange="location=this.options[this.selectedIndex].value; document.dammit.reset()" value="GO">
<option selected>&nbsp;BLAH BLAH</option>
<option value="blah blah">&nbsp;blah blah</option>
<option value="blah blah">&nbsp;blah blah</option>
<option value="blah blah">&nbsp;blah blah</option>
</select>
</td>
</form>
<tr>

Now the problem is, that I have a number of these jump menus on one page (http://www.eventpolynesia.com/indexspg77.htm), all with the exact same code format (except <form name> & <select name> values, which are unique for each jump menu) - some of these menus reset themselves with no problem, but some of them do not reset (preview testing inside FrontPage gives a 'document is null of not an object' error for the menus that do not reset).

It's driving me crazee :eek: - why do some work and others not :confused:

If anyone could help with this code, or suggest a better jump menu script, I would be very grateful :thumbsup:

TIA,

Dave

rwedge
07-19-2007, 02:27 AM
Since the reset occurs after the location is initiated, I suspect the document is 'history' before it is reset.
Try:
onChange="loc=this.options[this.selectedIndex].value; document.m1.reset();location.href=loc;"

ThanhNguyen
07-19-2007, 05:30 AM
Since the reset occurs after the location is initiated, I suspect the document is 'history' before it is reset.
Try:
onChange="loc=this.options[this.selectedIndex].value; document.m1.reset();location.href=loc;"

Yes, I think it should work.

good luck

Ocium
07-19-2007, 07:07 AM
Thanks for replying,

I used the code you sent, and it works fine on the jump menus that were already resetting themselves, but not on the ones that were not resetting themselves...

Now I know that it the fault is not the javascript itself, but rather something screwy going on with my table layout I guess. I have been over the code time after time, but cannot spot what is wrong - I have cut-n-pasted code from working jump menus into the <tr> which houses the jump menus that are not working, but it will not work after being pasted into the problematic <tr>

Short of restructuring all nested tables on my homepage http://www.eventpolynesia.com/ (in the hope that whatever glitch is happening now will not reoccur), I have no idea how to resolve this issue :eek:

Thank you very much for taking the time to help me out; I really appreciate your help.

rwedge
07-20-2007, 01:02 AM
HTML is causing the error, you forgot the closing </form> tag for the m3 through m7 forms.
That is what fails in FF, in IE, however, none of the forms reset. The alternative I posted should work in both browsers.

Ocium
07-20-2007, 11:48 PM
You should be promoted from 'regular coder' to 'legend' sir;
I cannot thank you enough for taking the time to help me with my problem, and for providing me with a solution :thumbsup:

Live long and prosper!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum