求助js鼠标悬浮事件:要求鼠标悬浮2秒才触发
1个回答
2017-12-06
展开全部
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>RunJS 演示代码</title>
<script>
var c;
var mo=function(){
c=setTimeout(function(){
alert("鼠标悬浮2秒才触发");
},2000);
}
var ct=function(){
clearTimeout(c);
}
</script>
</head>
<body>
<div onmouseover='mo()' onmouseout="ct()">
sdfsdfsdf
</div>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询