结果输出到

<div id="djs"></div>
<script type="text/javascript">
window.onload=clock;
function clock()
{
    var today=new Date(),h=today.getHours(),m=today.getMinutes(),s=today.getSeconds();
    var stopTime=new Date("9 22 2021 00:00:00"),stopH=stopTime.getHours(),stopM=stopTime.getMinutes(),stopS=stopTime.getSeconds();
    var shenyu=stopTime.getTime()-today.getTime(),shengyuD=parseInt(shenyu/(60*60*24*1000)),D=parseInt(shenyu)-parseInt(shengyuD*60*60*24*1000),shengyuH=parseInt(D/(60*60*1000)),H=D-shengyuH*60*60*1000,shengyuM=parseInt(H/(60*1000)),M=H-shengyuM*60*1000;
    S=parseInt((shenyu-shengyuD*60*60*24*1000-shengyuH*60*60*1000-shengyuM*60*1000)/1000);
    if(shengyuH<10)
    {
        shengyuH='0'+shengyuH;
    }
    if(shengyuM<10)
    {
        shengyuM='0'+shengyuM;
    }
    if(S<10)
    {
        S='0'+S;
    }
    document.getElementById("djs").innerHTML=(shengyuD+" Days "+shengyuH+":"+shengyuM+":"+S);
    setTimeout(clock,1000);
}
</script>
最后修改:2020 年 06 月 28 日
声明:无闻风博客|版权所有,违者必究|如未注明,均为原创| 转载:转载请注明原文链接