js弹出窗口带关闭
js弹出窗口带关闭,在这在网页中是常遇到的特效,二秒后出现。下面是源码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <div class="boxqq" id="menu_zdd"><p>web前端技术交流群邀请您的加入<br /> QQ群号:51056097 <span onclick="document.getElementById('menu_zdd').style.display='none'" style="color: #993333; font-weight:bold">点击关闭</span></p> </div> <div style="height:"800px""></div> <style> .boxqq{ background-color: #EAF7FF; border: 5px solid #2AAAFF; height: 39px; overflow: hidden; padding: 9px; text-align: left; width: 192px; display:none; } .boxqq p{ color: #FF1C3E; font-size: 13px; line-height: 20px; margin: 0; padding: 0; } </style> <script type="text/javascript"> function resizeDiv(){ alert("asdf"); } function resizeDiva(){ document.getElementById("menu_zdd").style.position="absolute"; document.getElementById("menu_zdd").style.top=(parseInt(document.documentElement.clientHeight,10)/2)+parseInt(document.documentElement.scrollTop,10)-50+"px"; document.getElementById("menu_zdd").style.left=((parseInt(document.documentElement.clientWidth,10)/2)-190)+"px"; } function block(){ document.getElementById("menu_zdd").style.display="block"; } window.onscroll=function (){ resizeDiva(); } window.onload=setTimeout("block(),resizeDiva()",2000); </script> </body> </html>
DEMO:js弹窗