position: absolute; Javascript onmounseout 失效
<div id="fmtDiv" style=" position: absolute;" onmounseout="alert('失去了焦点')">
<a href="http://www.qingruxu.com">php外包</a>
<a href="http://www.qingruxu.com">清如许工作室</a>
</div>
在DIV 中定义了 onmouseout 但在测试中发现,但鼠标移过<a >时晃触发了,这个事件。有人说用背景图片,背景颜色,html,body { height:100%}都无效。
最后使用Jquery 解决,原因是 DIV 的子元素,会触发DIV 的 onmouseout事件。
Jquery 中有一个事件可以解决这个问题。
$('#fmtDiv').mouseleave(function(){
alert('jquery');
});
- 上一篇:jquery cookie 插件
- 下一篇:PHP常量写在左边 编程的好习惯