zoukankan      html  css  js  c++  java
  • javascript实现奥运倒计时代码

    js实现奥运倒计时代码
    转自: Js中国
    http://javascriptxml.5d6d.com/thread-4-1-1.html
      
      
    <div>
        
    <div class="Bjday" id="timeDate" width="60">
        
    </div>
        
    <div class="Bjtim" id="times">
        
    </div>
    <SCRIPT>
      
              
    var now = new Date();
              
    function createtime(){
              
              
    var grt= new Date("8/08/2008 20:00:00");
              
              now.setTime(now.getTime()
    +250);
              days 
    = (grt - now) / 1000 / 60 / 60 / 24;
              dnum 
    = Math.floor(days);
              hours 
    = (grt - now) / 1000 / 60 / 60 - (24 * dnum);
              hnum 
    = Math.floor(hours);
              
    if(String(hnum).length ==1 ){hnum = "0" + hnum;}
              minutes 
    = (grt - now) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
              mnum 
    = Math.floor(minutes);
              
    if(String(mnum).length ==1 ){mnum = "0" + mnum;}
              seconds 
    = (grt - now) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
              snum 
    = Math.round(seconds);
              
    if(String(snum).length ==1 ){snum = "0" + snum;}
              
              document.getElementById(
    "timeDate").innerHTML = dnum;
              document.getElementById(
    "times").innerHTML = hnum + "<span style='margin:0 7px 0 7px'>:</span>"+ mnum + "<span style='margin:0 7px 0 7px'>:</span>"+ snum;
              }
              
              setInterval(
    "createtime()",250);        
                      
    </SCRIPT>
    </DIV>


  • 相关阅读:
    Dijkstra单源最短路模板
    Naming Company CodeForces
    Naming Company CodeForces
    CF
    CF
    Present CodeForces
    9绑定方法与非绑定方法
    pycharm设置连接
    8封装的意义和拓展性
    property特性
  • 原文地址:https://www.cnblogs.com/wangxiang/p/938590.html
Copyright © 2011-2022 走看看