日期:2014-05-16 浏览次数:20442 次
<script> if(typeof(HTMLElement)!="undefined") HTMLElement.prototype.contains=function(obj) { if(obj==this)return true; while(obj=obj.parentNode)if(obj==this)return true; return false; } function doit(evt){ evt = window.event || evt; var obj = evt.toElement || evt.relatedTarget; var pa = document.getElementById("pad"); if(pa.contains(obj)) return false; alert('out'); } </script> <div id="pad" onmouseout="doit(event);" style="padding:10px;width:200px;height:200px;background:#CCC"> <div style="background:#FFF">xxxxxx</div> </div>