PC 微信页面倒计时代码

时间:2016-11-30 17:15:46   收藏:0   阅读:407

PC:

1.html页面:

<div class="aTime">
     <em id="t_d"></em>
     <em id="t_h"></em>
     <em id="t_m"></em>
     <em id="t_s"></em>
</div>

2.js:

<script type="text/javascript">
  function GetRTime(){
    var end = "<?php echo $info[‘end_date‘]; ?>"+" 23:59:59";
    var EndTime= new Date(end);
    var NowTime = new Date();
    var t =EndTime.getTime() - NowTime.getTime();
    var d=0;
    var h=0;
    var m=0;
    var s=0;
    if(t>=0){
      d=Math.floor(t/1000/60/60/24);
      h=Math.floor(t/1000/60/60%24);
      m=Math.floor(t/1000/60%60);
      s=Math.floor(t/1000%60);
    }


    document.getElementById("t_d").innerHTML = d;
    document.getElementById("t_h").innerHTML = h;
    document.getElementById("t_m").innerHTML = m;
    document.getElementById("t_s").innerHTML = s;
  }
  setInterval(GetRTime,1000);

</script>

 

微信端js代码:

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!