首页 > 代码库 > 延时提示框
延时提示框
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>qq_info</title> <style type="text/css"> #div1{width:200px;height: 30px;background: red;} #div2{width:150px;height:20px;background: #ccc;margin:10px;display: none;} </style> <script type="text/javascript"> // ____________001_______________________ window.onload=function(){ var oDiv1=document.getElementById(‘div1‘); var oDiv2=document.getElementById(‘div2‘); var timer=null; oDiv1.onmouseover=function(){ oDiv2.style.display=‘block‘; clearTimeout(timer); } oDiv1.onmouseout=function(){ timer=setTimeout(function(){ oDiv2.style.display=‘none‘; },300); } oDiv2.onmouseover=function(){ clearTimeout(timer); } oDiv2.onmouseout=function(){ timer=setTimeout(function(){ oDiv2.style.display=‘none‘; },300); } } // _____________________001end________________________ // _____________________002___________________________ window.onload=function(){ var oDiv1=document.getElementById(‘div1‘); var oDiv2=document.getElementById(‘div2‘); var timer=null; function show(){ oDiv2.style.display=‘block‘; clearTimeout(timer); } function hide(){ timer=setTimeout(function(){ oDiv2.style.display=‘none‘; },300); } oDiv1.onmouseover=show; oDiv2.onmouseover=show; oDiv1.onmouseout=hide; oDiv2.onmouseout=hide;//注意js函数调用不加括号表示调用的函数整体,加括号表示调用函数返回的值 } //_____________________002end_________________________ //_____________________003____________________________ window.onload=function(){ var oDiv1=document.getElementById(‘div1‘); var oDiv2=document.getElementById(‘div2‘); var timer=null; oDiv1.onmouseover=oDiv2.onmouseover=function(){ oDiv2.style.display=‘block‘; clearTimeout(timer); } oDiv1.onmouseout=oDiv2.onmouseout=function(){ timer=setTimeout(function(){ oDiv2.style.display=‘none‘; },300); } } //_____________________003end_________________________ </script> </head> <body> <div id="div1"></div> <div id="div2"></div> </body> </html>
查看范例
延时提示框
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。