京东倒计时代码

时间:2022-01-22 22:04:09
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>商品倒计时-51windows.Net</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<p>商品抢购倒计时中...</p>
<p>此商品抢购时间还有<span id="_lefttime" style="color:red;font-size:18pt;"></span></p>
<SCRIPT LANGUAGE="JavaScript">
function _fresh()
{
    var endtime=new Date("8 25, 2015 12:59:00");
    var nowtime = new Date();
    var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
    if(leftsecond<0){leftsecond=0;}
    __d=parseInt(leftsecond/3600/24);
    __h=parseInt((leftsecond/3600)%24);
    __m=parseInt((leftsecond/60)%60);//2008-3-12改正,原来将60写成24了
    __s=parseInt(leftsecond%60);
    document.getElementById("_lefttime").innerHTML=__d+""+__h+"小时"+__m+""+__s+"";
}
_fresh()
setInterval(_fresh,1000);
</SCRIPT>
</body>
</html>