<!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>

 

posted on 2014-11-20 17:32  高尔础础  阅读(164)  评论(1编辑  收藏  举报