购物网站倒计时

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>拍卖倒计时</title>
<script>
window.onload=function(){
    function tick()
    {
        var oCount=document.getElementById(count);
        var timer=null;
        oDateTarget=new Date();
        oDateTarget.setFullYear(2014,10,20);
        oDateTarget.setHours(13,06,0,0);
        oDateNow=new Date();
        leftTime=parseInt((oDateTarget.getTime()-oDateNow.getTime())/1000);
        var day=parseInt(leftTime/(60*60*24));
        leftTime%=(60*60*24);
        var h=parseInt(leftTime/(60*60));
        leftTime%=(60*60);
        var m=parseInt(leftTime/60);
        leftTime%=60;
        oCount.innerHTML=day++h+小时+m+分钟+leftTime;
        if(leftTime<=0)
        {
            oCount.innerHTML=结束了;
            clearInterval(tick);
        }
    }
    tick();
    setInterval(tick,500)
};
</script>
</head>

<body>
<div>距离开始:<span id="count"></span></div>
</body>
</html>

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。