• 时分秒 定时器


     时分秒 定时器

    <p  class="yh-hope-time"><i id="hour_show">00</i>:<i id="minute_show">00</i>:<i  id="second_show">00</i></p>
    <
    script type = "text/javascript" > var intDiff = parseInt(1800); //倒计时总秒数量 function timer(intDiff) { var f = window.setInterval(function() { var //day = 0, hour = 0 , minute = 0, second = 0; //时间默认值 if (intDiff > 0) {   day = Math.floor(intDiff / (60 * 60 * 24));   hour = Math.floor(intDiff / (60 * 60)) - (day * 24);   minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);   second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60); }else{   window.clearInterval(f); } if (minute <= 9) minute = '0' + minute; if (second <= 9) second = '0' + second;  document.getElementById("hour_show").innerText='0'+hour;   document.getElementById("minute_show").innerText=minute;   document.getElementById("second_show").innerText=second;   intDiff--; }, 1000); } timer(intDiff);

    </script>
  • 相关阅读:
    FastAdmin 提示框 toastr 改变文字
    FastAdmin 将会员模块升级为基础模块的升级指导
    随笔
    随笔
    c++11 lambda(了解)
    c++11 类型推断
    boost::archive::text_oarchive
    std::ostringstream
    随笔
    随笔1
  • 原文地址:https://www.cnblogs.com/xiaoxiao2014/p/5535411.html
Copyright © 2020-2023  润新知