js关于触发事件的问题!~~~
想问问怎么实现时间的延迟触发:比如mouseenter事件,当鼠标停在某元素上超过XX时间才触发,如果不是则不响应。
能举个简单的例子吗?谢谢~~~!!
------解决方案--------------------
<span id="myid">注册</span>
<script>
function aa(){
$actty=function (){alert('ok')};
actts=setTimeout($actty,5000);
}
document.getElementById("myid").onmouseover=function(){aa()}
document.getElementById("myid").onmouseout=function(){clearTimeout(actts)}
</script>
mouseenter/mouseleave