<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
#div1 {
width: 50px;
height: 50px;
background: red;
margin: 10px;
float: left;
}
#div2 {
width: 300px;
height: 300px;
background: gray;
margin: 10px;
float: left;
display: none;
}
</style>
<script>
window.onload = function(){
var oDiv1 = document.getElementById("div1");
var oDiv2 = document.getElementById("div2");
var times = null;
oDiv1.onmouseout = oDiv2.onmouseout = function(){
times = setTimeout(function (){
oDiv2.style.display = 'none';
},500);
}
oDiv1.onmouseover = oDiv2.onmouseover = function(){
clearTimeout(times);
oDiv2.style.display = 'block';
}
}
</script>
</head>
<body>
<div id = "div1"></div>
<div id = "div2"></div>
</body>
</html>
延时提示框
最新推荐文章于 2023-04-28 09:12:32 发布