V
VA
If I have
<td onMouseOver="foo(event,this,'string');">something</td>
It works fine i.e. the event handler function foo is fired with the
event parameter containing the event. I do the cross-browser thing to
handle the event parameter
var evt = (evt) ? evt : ((window.event) ? event : null);
and I am all set
But when I try to do the same thing by scripting i.e. get the TD node
via the DOM and add in the event handler like so
var td=document.getElementById('tdid')
td.onmouseover=function() {
foo(event,this,"string");
|
It works in IE, but in Firefox (1.x), I get an error in the JS console
"event is not defined".
Why is this? Any way to get consistent, cross-browser behaviour?
Thanks
<td onMouseOver="foo(event,this,'string');">something</td>
It works fine i.e. the event handler function foo is fired with the
event parameter containing the event. I do the cross-browser thing to
handle the event parameter
var evt = (evt) ? evt : ((window.event) ? event : null);
and I am all set
But when I try to do the same thing by scripting i.e. get the TD node
via the DOM and add in the event handler like so
var td=document.getElementById('tdid')
td.onmouseover=function() {
foo(event,this,"string");
|
It works in IE, but in Firefox (1.x), I get an error in the JS console
"event is not defined".
Why is this? Any way to get consistent, cross-browser behaviour?
Thanks