Blogger Information
Blog 21
fans 0
comment 0
visits 19955
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
JQuery 的基本语法
电动机的博客
Original
697 people have browsed it

<!DOCTYPE html>
<html>
<head>
 <title>倒计时</title>
 <script type="text/javascript" src="css/jquery-3.3.1.min.js"></script>
 <style type="text/css">
  div{
   width: 1300px;
      height: 180px;
      margin: 50px auto;
      background: green;
      font-size: 36px;
      line-height: 180px;
      text-align: center;
      color:#ccc;
  }
 </style>
</head>
<body>
 <div>
  <p>清明节倒计时:<span></span></p>
 </div>
 <script type="text/javascript">
  $(function(){
   function Ro(){
    var d=Date.parse("Apr 05,2019")
    var date=new Date()
    var dd=date.getTime()
    // console.log(dd)
    //getTime() 方法可返回距 1970 年 1 月 1 日之间的毫秒数
      // 1秒等于1000毫秒,1分钟等于60秒,一小时=60分钟等于3600秒,一天24小时=86400秒
    var ds=Math.floor((d-dd)/1000)//总秒
    var days=Math.floor(ds/86400)//天数
    var hours=Math.floor(ds%86400/3600)//小时数
    var minus=Math.floor(ds%3600/60)//分时数
    var secs=Math.floor(ds%60)//秒时数
    $('span').text(days+"天"+hours+"小时"+minus+"分钟"+secs+"秒")


   }
   setInterval(Ro,1000)
  })
 </script>

</body>
</html>

 

Correction status:Uncorrected

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
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!