倒计时
来源:互联网 发布:国际期货软件下载 编辑:程序博客网 时间:2024/06/05 15:59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>60s倒计时</title>
</head>
<body>
<img src="">
<a id="ii" href="javascript:">dianjihhh</a>
<script type="text/javascript">
function countdown(objId, _time) {
document.addEventListener("DOMContentLoaded", function() {
var obj = document.getElementById(objId),
time = _time,
content = obj.innerText;
obj.onclick = function() {
var _flag = this.getAttribute("data-flag");
if (_flag == "doing") return;
var cd = setInterval(function() {
obj.setAttribute("data-flag", "doing");
obj.onmouseover = function () {
this.style.cursor = "not-allowed";
}
obj.onmouseout = function () {
this.style.cursor = "pointer";
}
obj.onmouseover
obj.innerText = time + "S";
if (time === 0) {
obj.removeAttribute("data-flag");
clearInterval(cd);
obj.innerText = content;
time = _time;
} else {
time--;
}
}, 1000);
};
});
}
countdown("ii", 5);
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>60s倒计时</title>
</head>
<body>
<img src="">
<a id="ii" href="javascript:">dianjihhh</a>
<script type="text/javascript">
function countdown(objId, _time) {
document.addEventListener("DOMContentLoaded", function() {
var obj = document.getElementById(objId),
time = _time,
content = obj.innerText;
obj.onclick = function() {
var _flag = this.getAttribute("data-flag");
if (_flag == "doing") return;
var cd = setInterval(function() {
obj.setAttribute("data-flag", "doing");
obj.onmouseover = function () {
this.style.cursor = "not-allowed";
}
obj.onmouseout = function () {
this.style.cursor = "pointer";
}
obj.onmouseover
obj.innerText = time + "S";
if (time === 0) {
obj.removeAttribute("data-flag");
clearInterval(cd);
obj.innerText = content;
time = _time;
} else {
time--;
}
}, 1000);
};
});
}
countdown("ii", 5);
</script>
</body>
</html>
0 0
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时、、、、、
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- 倒计时
- VC----MFC-简单绘图
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- linux之基础shell脚本编程1 基础变量赋值
- hdu1878 欧拉回路(并查集)
- 倒计时
- 网易有道2017内推编程题2
- eclipse中提示找不到Httpservlet类
- map+组合数学_____Eureka( POJ 5738 2016多校第二场)
- 微信自定义菜单view类型获取openid访问网页
- linux之基础shell脚本编程2 if语句循环判断
- 03 Button 按钮
- Toggle, Tween(完善篇)
- JDBC (数据库连接)