分钟秒钟的倒计时

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Amy_cloud/article/details/78793893
<p id='headerNum'>00:20:00</p>
    var hour = $('#headerNum').text().split(':')[0]
    var minute = $('#headerNum').text().split(':')[1]
    var second = $('#headerNum').text().split(':')[2]
    var settime = setInterval(mytime,1000);
    function mytime(){
        if(second <= 0 ){
            second = 60;
            minute--;                   
        }       
        second--;
        if(minute < 0){     
            clearInterval(settime);
            $('#headerNum').text('00:00:00');
            return;
        }
        $('#headerNum').text(hour + ':' + (minute<10?'0'+minute:minute) + ':' + (second<10?"0"+second:second))

    }
展开阅读全文

没有更多推荐了,返回首页