Js暂停倒数参考案例
来源:互联网 发布:plc编程及应用第3版 编辑:程序博客网 时间:2024/05/01 11:25
感谢道友文章:http://www.zztuku.com/JS/Times/20130104_5550.html
贴代码:
<!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" />
<meta name="description" content="" />
<style>
body,div{margin:0;padding:0;}
body{color:#fff;font:16px/1.5;}
#down_wwwzzjsnet{width:300px;text-align:center;background:#1a1a1a;margin:10px auto;padding:20px 0;}
input{border:0;width:283px;height:50px;cursor:pointer;margin-top:20px;background:url(http://www.zzjs.net/img/20120410wwwzzjsnet_1.png) no-repeat;}
input.cancel{background-position:0 -50px;}
span{color:#000;width:80px;line-height:2;background:#fbfbfb;border:2px solid #b4b4b4;margin:0 10px;padding:0 10px;}
</style>
<script>
window.onload = function ()
{
var oCountDown = document.getElementById("down_wwwzzjsnet");
var aInput = oCountDown.getElementsByTagName("input")[0];
var timer = null;
aInput.onclick = function ()
{
this.className == "" ? (timer = setInterval(updateTime, 1000), updateTime()) : (clearInterval(timer));
this.className = this.className == '' ? "cancel" : '';
};
function format(a)
{
return a.toString().replace(/^(\d)$/,'0$1')
}
function updateTime ()
{
var aSpan = oCountDown.getElementsByTagName("span");
var oRemain = aSpan[0].innerHTML.replace(/^0/,'') * 60 + parseInt(aSpan[1].innerHTML.replace(/^0/,''));
if(oRemain <= 0)
{
clearInterval(timer);
return
}
oRemain--;
aSpan[0].innerHTML = format(parseInt(oRemain / 60));
oRemain %= 60;
aSpan[1].innerHTML = format(parseInt(oRemain));
}
}
</script>
</head>
<body>
<div id="down_wwwzzjsnet">
<span>01</span>分钟<span>40</span>秒
<input type="button" value="" />
</div>
</body>
</html>
- Js暂停倒数参考案例
- js暂停
- js----让程序暂停
- 暂停JS向下执行
- js 暂停执行
- js 实时刷新 暂停
- js模拟暂停
- js 倒数计时器
- JS倒数计时器
- js 倒数秒执行
- js简单倒数计时
- JS倒数计时器
- js促销倒数计时器
- log4j 配置案例参考
- js实现暂停,淡出效果。
- JS动态设置倒数时间
- js实现倒数计时器功能
- JS案例
- MySQL允许远程授权
- solaris veritas_SF5.0
- linux下实时查看tomcat运行日志
- 只有dll的情况下如何动态调用里面的类成员函数
- 浅析分布式系统韩伟
- Js暂停倒数参考案例
- PAT_乙级 1005 继续(3n+1)猜想
- Caffe for Python 官方教程(翻译)
- Android开发getCacheDir和getFilesDir区别
- 微信小程序开发初探
- leetcode--balanced-binary-tree
- 编译报错:Undefined symbols for architecture arm64: "_OBJC_CLASS_$_类名", referenced from
- Static关键字
- Java基础(3)构造函数