<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>广告自动关闭</title>
</head>
<style>
.tip{
position: fixed;
top: 100px;
left: 400px;
display: block;
width: 400px;
height: 200px;
border-style: dotted;
border-width: thin;
border-color: darkgreen;
background: #f0c;
z-index: 100;
} </style>
<script type="text/javascript" src="js/base.js"></script>
<script>
/*
window.onload = function(){
var timer = setInterval(function(){
var _span = document.getElementsByTagName("span")[0];
_span.innerHTML -= 1; if(_span.innerHTML == 0){
clearInterval(timer);
document.getElementById("ad").style.display = "none";
}
},1000);
}
*/ window.onload = function(){
var num = 5;
var oDiv = document.getElementById("ad");
var t = setInterval(function(){
countDown();
if(num == 0) {
clearInterval(t);
oDiv.style.display = "none";
}
},1000); function countDown(){
oDiv.children[0].innerHTML -= 1;
num--;
}
}
</script>
<body>
<div id="ad" class="tip">
我是一条广告,谢谢!
<span style="color:yellow; font-weight:bold;">5</span>秒钟后自动关闭
</div>
</body>
</html>

  

 

最新文章

  1. 封装自己的DB类(PHP)
  2. .NET 基础 一步步 一幕幕 [前言]
  3. sql语句优化SQL Server
  4. sublime text3点击ctrl+B无法运行Python程序?
  5. Struts2+jQuery+Json零配置实现ajax
  6. Redis的五种数据结构
  7. UVa 二叉树重建(先序+中序求后序)
  8. BZOJ 1568 Blue Mary开公司
  9. 图像二值化----otsu(最大类间方差法、大津算法)
  10. 通过web代理进行跨域访问,http请求返回超时的问题定位
  11. Wireshark - 过滤规则
  12. 【POJ】2155 Matrix
  13. 某APK中使用了动态注册BroadcastReceiver,Launcher中动态加载此APK出现java.lang.SecurityException异常的解决方法
  14. js--事件对象的理解1
  15. [Angular Tutorial] 0-Bootstraping
  16. php 图片合成时文字颜色丢失
  17. haploview出现“results file must contain a snp column”的解决方法
  18. sql查询一个字段不同值并返回
  19. Java 8新特性之 并行和并行数组(八恶人-8)
  20. android ListView 分页加载数据

热门文章

  1. LeetCode——Unique Paths
  2. 06_MySQL DQL_分组查询
  3. 比较好的Json 格式数据
  4. Nginx的坑
  5. Gray Code,求格林码
  6. virtual dom &amp; mvvm
  7. intent Filter
  8. 【Demo】jQuery 表格内容动态排序
  9. POJ-3659-最小支配集裸题/树形dp
  10. 在线修改Schema