EwS
asked on
window.event.target not working
Each row in my table consists of a number of columns. The first column contains a checkbox. I want to display details for the row if any column of the row has been clicked, except the first one. This code works fine in IE, but when I run it in Mozilla, I get "targ has no properties" error. It looks like window.event is not recognized because none of the alerts are displayed. Is it my browser settings?
Thanks.
<tbody onClick='doSelect(this);'>
var targ;
if (!e) {
alert("1");
var e = window.event;
}
if (e.target) {
alert("2");
targ = e.target;
}
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
if ( targ.tagName == "INPUT" && targ.type == "checkbox" ) {
return;
}
Thanks.
<tbody onClick='doSelect(this);'>
var targ;
if (!e) {
alert("1");
var e = window.event;
}
if (e.target) {
alert("2");
targ = e.target;
}
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
if ( targ.tagName == "INPUT" && targ.type == "checkbox" ) {
return;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER