商场倒计时

<!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" />
<title>无标题文档</title>
<script type="text/javascript">
function calculagraph(){
this._id=null;
//this._sT=null;
this._cT=null;
this._eT=null;
this._lT=null;
this._gT=function(){
if (this._lT==null){
var _xT=(parseInt(this._eT.match(/-(\d+)\s/)[1])>=parseInt(this._cT.match(/-(\d+)\s/)[1]))?(parseInt(this._eT.match(/-(\d+)\s/)[1])-parseInt(this._cT.match(/-(\d+)\s/)[1])):0;
//this._sT=parseInt(this._sT.match(/\s(\d+)\D/)[1]*3600)+parseInt(this._sT.split(":")[1]*60)+parseInt(this._sT.split(":")[2]);
this._cT=parseInt(this._cT.match(/\s(\d+)\D/)[1]*3600)+parseInt(this._cT.split(":")[1]*60)+parseInt(this._cT.split(":")[2]);
this._eT=_xT*24*3600+parseInt(this._eT.match(/\s(\d+)\D/)[1]*3600)+parseInt(this._eT.split(":")[1]*60)+parseInt(this._eT.split(":")[2]);
this._lT=(this._eT-this._cT);
}
if (this._lT>=0){
var _H=Math.floor(this._lT/3600);
var _M=Math.floor((this._lT-_H*3600)/60);
var _S=(this._lT-_H*3600)%60;
document.getElementById(this._id).innerHTML="剩余<strong>"+ _H +"</strong>小时<strong>"+ _M +"</strong>分<strong>"+ _S +"</strong>秒";
this._lT--;
}else{
document.getElementById(this._id).innerHTML="<strong style='font-size:14px;'>抢购结束</strong>";
clearInterval(this._interval);
}
}
this._interval=function(){
var o=this;
this._interval=setInterval(function(){o._gT()},1000)
}
}
</script>
</head>
<body>
<div id="time536"></div>
<script type="text/javascript">
var t536=new calculagraph();
t536._id='time536';
//t536._sT='2009-10-14 9:00:00';
t536._cT='2009-10-14 11:38:04';
t536._eT='2009-10-14 11:59:00';
t536._interval();
</script>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值