<!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>
上一篇.net 操作XML小结
下一篇商场倒计时
商场倒计时
最新推荐文章于 2024-06-07 16:35:02 发布