/ Published in: JavaScript

mouse out event of a div will be triggered even mouse entered a element with in a div which we do not want it happen.
But all browsers are agree on it...
But all browsers are agree on it...
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var show = function (divId){ var div = $j('#'+divId); div.show(); div.focus(); div.bind("mouseout",function(e){ if (!e) var e = window.event; var tg = (window.event) ? e.srcElement : e.target; if (tg.nodeName != 'DIV') return; var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement; while (reltg != tg && reltg.nodeName != 'BODY') reltg= reltg.parentNode if (reltg== tg) return; $j(this).hide(); }); }; /***sample***/ html: <div onmouseout="alert('oh no!! mouse left me alone...');"> <a>evil element</a> </div>
Comments
