首页 > 代码库 > 淘宝倒计时

淘宝倒计时

<span id="times"></span><SCRIPT LANGUAGE="JavaScript">var endtime=new Date("2011/10/16,23:00:00");//可以更改时间var nowtime=new Date("2011/10/16,22:50:55");var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);function _fresh(){__d=parseInt(leftsecond/3600/24);__h=parseInt((leftsecond/3600)%24);__m=parseInt((leftsecond/60)%60);__s=parseInt(leftsecond%60);document.getElementById("times").innerHTML="<font face=黑体 size=5><b>"+__d+"</font></b>"+"天&nbsp;"+"<font face=黑体 size=5><b>"+__h+"</font></b>"+"小时&nbsp;"+"<font face=黑体 size=5><b>"+__m+"</font></b>"+"分&nbsp;"+"<font face=黑体 size=5><b>"+__s+"</font></b>"+"";leftsecond --;if(leftsecond<=0){document.getElementById("times").innerHTML="抢购已结束";clearInterval(sh);}}_fresh()var sh;sh=setInterval(_fresh,1000);</SCRIPT>

 

淘宝倒计时