标签:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style type="text/css"> #div1 { width: 50px; height: 50px; background: red; float: left; } #div2 { width: 200px; height: 200px; background: gray; float: left; margin-left: 20px; display: none; } </style> <script type="text/javascript"> window.onload = function () { var oDiv1 = document.getElementById(‘div1‘); var oDiv2 = document.getElementById(‘div2‘); oDiv2.onmouseover = oDiv1.onmouseover = function () { oDiv2.style.display = ‘block‘; clearInterval(timer); }; oDiv2.onmouseout = oDiv1.onmouseout = function () { timer = setInterval(function () { oDiv2.style.display = ‘none‘; },1000); }; }; </script> </head> <body> <div id="div1"></div> <div id="div2"></div> </body> </html>
标签:
原文地址:http://www.cnblogs.com/zhuni/p/4696567.html