Click to See Complete Forum and Search --> : onChange


Dogboy
04-02-2003, 01:11 PM
I am new to javascripting.... I am trying to intiate a form script.... here is my code....

<form name="go" onSubmit="{return false;}">
<select name="select" onChange="window.document.location=window.document.go.select.value;">
<option value="#">Please Select</option>
<option value="http://www.whatever.com/">Whatever.com</option>
</select>
</form>

This script works fine when used by itself in new document...
however, when I add it to my existing template, it won't work at all....
I keep getting this error:

'window.document.go.select is' is not an object....

Any help would be much appreciated....

Thanx

Dogboy

JackTheTripper
04-02-2003, 01:15 PM
try changing the name of your select menu to something else...


<form name="go" onSubmit="{return false;}">
<select name="jumpMenu" onChange="window.document.location=window.document.go.jumpMenu.value;">
<option value="#">Please Select</option>
<option value="http://www.whatever.com/">Whatever.com</option>
</select>
</form>

Dogboy
04-02-2003, 01:22 PM
I'm still getting the same error only with a new name for the select box....

'window.document.go.CompSelect' is not an object....

Any other suggestions????

JackTheTripper
04-02-2003, 01:27 PM
I think you have another form on the same page named "go" Change the name of this form to something else like "jumpForm"

Dogboy
04-02-2003, 01:40 PM
I have now modified both the form and the select name and the same error occurs, both on pc and mac versions of browsers....

Script:
<form name="CompForm" onSubmit="{return false;}">
<select name="CompSelect" onChange="window.document.location=window.document.CompForm.CompSelect.value;">
<option value="#">Please Select</option>
<option value="http://www.whatever.com/">Whatever.com</option>
</select>
</form>

Errors:
'window.document.CompForm.CompSelect' is not an object.... mac IE5
'window.document.CompForm.CompSelect' is null or not an object.... pc IE6

Do I need to create an object???? it seems I am not able to access this particular variable for some reason.....

JackTheTripper
04-02-2003, 01:43 PM
Sorry, you got me on this one. :confused:

Dogboy
04-02-2003, 01:45 PM
Thanx for giving it a try....

Is there anyone else who might be able to help????

Dogboy

Jona
04-02-2003, 01:56 PM
Ok, your original form was fine except for this:

<form name="go" onSubmit="return false;">
<select name="select" onChange="location=document.go.select[document.go.select.selectedIndex].value;">
<option value="#">Please Select</option>
<option value="http://www.whatever.com/">Whatever.com</option>
</select>
</form>

Dogboy
04-02-2003, 02:12 PM
Hi Jona....

I gave that one a try....for some reason I am still getting the error....

Error

'document.select.go' is not an object....

could there be a script elswhere in my document that would hinder this one????

Jona
04-02-2003, 02:37 PM
It should be document.go.select not document.select.go :D

Dogboy
04-02-2003, 02:39 PM
sorry jona....

I did not type the error message correctly, but the script is correct.....

Dogboy
04-02-2003, 04:16 PM
Can anyone help out with this?????

JackTheTripper
04-02-2003, 04:30 PM
can you post the page to a web site so we can see it in action?

Dogboy
04-02-2003, 04:33 PM
www.bargainbookco.com/detail.cfm

it's the drop down on the left side of the screen....."computer books"

Thanx....

Dogboy
04-02-2003, 06:03 PM
Thank you very much... that's the one that did it.......

(much appreciation to all who had input)

Dogboy :)

JackTheTripper
04-02-2003, 07:05 PM
Dogboy, that fix doesn't work in Netscape 4.7 FYI.

Gotta go home but will look at it again tomorrow.

Dogboy
04-02-2003, 07:08 PM
Thanx for the "heads up" Jack.....