/ Published in: JavaScript
Usage: onmouseout='if (isMouseLeaveOrEnter(event, this)) YourActionHere();' onmouseover='if (isMouseLeaveOrEnter(event, this)) YourOtherActionHere();'
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// from http://www.dynamic-tools.net/toolbox/isMouseLeaveOrEnter/ // this function determines whether the event is the equivalent of the microsoft // mouseleave or mouseenter events. function isMouseLeaveOrEnter(e, handler) { if (e.type != 'mouseout' && e.type != 'mouseover') return false; var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement; while (reltg && reltg != handler) reltg = reltg.parentNode; return (reltg != handler); }
URL: http://www.dynamic-tools.net/toolbox/isMouseLeaveOrEnter/