Netscape does not fire onChange!

F

Frowning Freezer

I have a function in an external javascript file which I fire from an
onChange event in a <SELECT> tag. Everything works fine in IE but not
in Netscape/Mozilla/Opera. This is my onChange statement:

onChange="division_changed(this.value);"

If I put an alert() in the external script (outside any function) it
executes fine. If I put an alert directly in onChange it also works
fine! But this function that I'm calling simply won't get started.

What do I do to get it to work in these alternative browsers?
 
L

Lee

Frowning Freezer said:
I have a function in an external javascript file which I fire from an
onChange event in a <SELECT> tag. Everything works fine in IE but not
in Netscape/Mozilla/Opera. This is my onChange statement:

onChange="division_changed(this.value);"

If I put an alert() in the external script (outside any function) it
executes fine. If I put an alert directly in onChange it also works
fine! But this function that I'm calling simply won't get started.

What do I do to get it to work in these alternative browsers?

It would help to see your code.

Obviously the onChange handler is actually firing, since defining it
as "alert()" works.

The last time I looked (which has been some time), Select controls didn't have a
"value" attribute in Netscape. It was just a shortcut added by Microsoft.

onchange="division_changed(options[selectedIndex].value)"
might work.
 
H

Hywel

I have a function in an external javascript file which I fire from an
onChange event in a <SELECT> tag. Everything works fine in IE but not
in Netscape/Mozilla/Opera. This is my onChange statement:

onChange="division_changed(this.value);"

If I put an alert() in the external script (outside any function) it
executes fine. If I put an alert directly in onChange it also works
fine! But this function that I'm calling simply won't get started.

What do I do to get it to work in these alternative browsers?

I just tried this in IE6, Firefox, Opera 7.something, Mozilla. The only
difference between any of them is that IE alerts nothing, but it still
does the alert. What is the Mozilla JavaScript console telling you?

<script>
function division_changed(value)
{
alert(value);
}
</script>

<form>
<select onChange="division_changed(this.value);">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</form>
 
M

Mick White

Frowning said:
I have a function in an external javascript file which I fire from an
onChange event in a <SELECT> tag. Everything works fine in IE but not
in Netscape/Mozilla/Opera. This is my onChange statement:

onChange="division_changed(this.value);"

If I put an alert() in the external script (outside any function) it
executes fine. If I put an alert directly in onChange it also works
fine! But this function that I'm calling simply won't get started.

What do I do to get it to work in these alternative browsers?

First, I would make sure my references were correct.

onchange="division_changed(this[this.selectedIndex].value);"

or more formally:

onchange="division_changed(this.options[this.selectedIndex].value);

Mick
 
F

Frowning Freezer

I have a function in an external javascript file which I fire from an
onChange event in a <SELECT> tag. Everything works fine in IE but not
in Netscape/Mozilla/Opera. This is my onChange statement:

onChange="division_changed(this.value);"

If I put an alert() in the external script (outside any function) it
executes fine. If I put an alert directly in onChange it also works
fine! But this function that I'm calling simply won't get started.

What do I do to get it to work in these alternative browsers?

First, I would make sure my references were correct.

onchange="division_changed(this[this.selectedIndex].value);"

or more formally:

onchange="division_changed(this.options[this.selectedIndex].value);

Thanks, this made my day - together with Macromedia's MM_findObj
function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top