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