@UltimaterNov 03.2005 — #In Firefox you'd use target in place of srcElement and you'll need to refer to the function's first argument to get the event object. <i> </i>var element=arguments[0].target.parentNode;
@UltimaterNov 03.2005 — #A cross-browser approach, depending on what event is used, would look like this: <i> </i>function whatever(e){ if(!e)e=window.event; var t; if(e.srcElement) t=e.srcElement.parentNode else if(e.target) t=e.target.parentNode else return true;
//alright, var "t" contains the parentNode //what now!? alert(t?1:0);
I tried your code and it works just fine in IE but when I try it in Firefox it doesn't work at all!
Attached is a simple page that works fine in IE but when I run it in Firefox I get nothing. It won't even to to the alert. Do you know what the problem is?
@UltimaterNov 03.2005 — #"t" is an element similar to that which is returned from the DOM document.getElementById method. alert(t.getAttribute("name")); // alerts "null" if the tag's name attribute is not set.