zoukankan      html  css  js  c++  java
  • js实现倒计时(分:秒)

    上代码:

    //倒计时start     需要传入的参数为秒数,此方法倒计时结束后会自动刷新页面
    function resetTime(timetamp){
        var timer=null;
        var t=timeStamp;
        var m=0;
        var s=0;
        m=Math.floor(t/60%60);
        m<10&&(m='0'+m);
        s=Math.floor(t%60);
        function countDown(){
            s--;
            s<10&&(s='0'+s);
            if(s.length>=3){
                s=59;
                m="0"+(Number(m)-1);
            }
            if(m.length>=3){
                m='00';
                s='00';
                clearInterval(timer);
            }
            $("#Pk10Time").html(m+"分"+s+"秒");
            if(m==0 && s==0){
                location.reload();
            }
        }
        timer=setInterval(countDown,1000);
    }
    //倒计时end
    

      

    let the world have no hard-to-write code ^-^
  • 相关阅读:
    C# FTP操作
    SWUST OJ(963)
    插入排序(折半插入排序)
    SWUST OJ(962)
    SWUST OJ(961)
    SWUST OJ(960)
    SWUST OJ(957)
    SWUST OJ(956)
    SWUST OJ(955)
    SWUST OJ(954)
  • 原文地址:https://www.cnblogs.com/ovim/p/11153998.html
Copyright © 2011-2022 走看看