Blogger Information
Blog 7
fans 0
comment 0
visits 3471
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
2019年农历春节倒计时-2019年01月21号
郑成功的博客
Original
679 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <style type="text/css">
      .content{ height: 400px; width: 800px; background-color: pink; margin: 0 auto; position: relative;}
      .main{ color: #fff; position:absolute; top: 120px; left: 150px; }
    </style>
</head>

<body>

        <script>
function showTime(){
    var timestamp=new Date().getTime();
var chuntime=(new Date("2019/02/05 00:00:00")).getTime();
var countdown=(chuntime-timestamp)/1000;
var day = Math.floor(countdown/3600/24);    //倒计时还有多少天
var hr = Math.floor(countdown/3600%24);     //倒计时还有多少小时(%取余数)
var min = Math.floor(countdown/60%60);      //倒计时还有多少分钟
var sec = Math.floor(countdown%60); 

$('.main').text("2019年农历春节倒计时:"+day+'天'+hr+'小时'+min+'分'+sec+'秒');

setTimeout(showTime,1000); 

}

 showTime();

        </script>
    <div class="content">
        <div class="main"></div>
    </div>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments