ITPub博客

首页 > IT职业 > IT图书 > 弹出窗口自动关闭

弹出窗口自动关闭

原创 IT图书 作者:chunzhisu 时间:2014-10-28 11:21:31 0 删除 编辑

点击(此处)折叠或打开

  1. <style type=\"text/css\">
  2. <!--
  3. #sponsorAdDiv {position:absolute; height:1; width:1; top:0; left:0;}
  4. -->
  5. </style>
  6. <SCRIPT LANGUAGE=\"JavaScript1.2\">
  7. adTime=6; //关闭窗口等待的时间
  8. chanceAd=1;
  9. var ns=(document.layers);
  10. var ie=(document.all);
  11. var w3=(document.getElementById && !ie);
  12. adCount=0;
  13. function initAd(){
  14. if(!ns && !ie && !w3) return;
  15. if(ie) adDiv=eval(\'document.all.sponsorAdDiv.style\');
  16. else if(ns) adDiv=eval(\'document.layers[\"sponsorAdDiv\"]\');
  17. else if(w3) adDiv=eval(\'document.getElementById(\"sponsorAdDiv\").style\');
  18. randAd=Math.ceil(Math.random()*chanceAd);
  19. if (ie||w3)
  20. adDiv.visibility=\"visible\";
  21. else
  22. adDiv.visibility =\"show\";
  23. if(randAd==1) showAd();
  24. }
  25. function showAd(){
  26. if(adCount<adTime*10){adCount+=1;
  27. if (ie){documentWidth =document.body.offsetWidth/2+document.body.scrollLeft-20;
  28. documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;}
  29. else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
  30. documentHeight=window.innerHeight/2+window.pageYOffset-20;}
  31. else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
  32. documentHeight=self.innerHeight/2+window.pageYOffset-20;}
  33. adDiv.left=documentWidth-200;adDiv.top =documentHeight-200;
  34. setTimeout(\"showAd()\",100);}else closeAd();
  35. }
  36. function closeAd(){
  37. if (ie||w3)
  38. adDiv.display=\"none\";
  39. else
  40. adDiv.visibility =\"hide\";
  41. }
  42. onload=initAd;
  43. </script>
  44. <div id=\"sponsorAdDiv\" style=\"visibility:hidden\">
  45. <table width=\"450\" height=\"350\" bgcolor=\"008000\"><tr><td>
  46. <table width=\"445\" height=\"345\" bgcolor=\"F0FFF0\"><tr><td>
  47. <center>欢迎来到,将于5秒后自动关闭,石家庄播音主持</center>
  48. </td></tr></table></td></tr></table></div>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29737856/viewspace-1311597/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-07-04

  • 博文量
    95
  • 访问量
    122215