js团购倒计时函数代码

<h1>团购啦!</h1>
<p>还剩<span id="times"></span></p>

<SCRIPT LANGUAGE="JavaScript">
function _fresh(){
var endtime=new Date("2012/12/20,00:00:00");
var nowtime = new Date();
var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
__d=parseInt(leftsecond/3600/24);
__h=parseInt((leftsecond/3600)%24);
__m=parseInt((leftsecond/60)%60);
__s=parseInt(leftsecond%60);
document.getElementById("times").innerHTML=__d+"天 "+__h+"小时"+__m+"分"+__s+"秒";
if(leftsecond<=0){

js团购倒计时函数代码

     document.getElementById("times").innerHTML="团购结束!";
clearInterval(sh);
}
}
_fresh()
var sh;
sh=setInterval(_fresh,1000);
</SCRIPT>
上一篇:团购、定时抢购倒计时js版


下一篇:SRM479