60s倒计时

js多少秒倒计时

function countDown(tim) {
            var timer = null, tim = tim || 60;
            var again = tim;
            clearInterval(timer);
            timer = setInterval(function() {
                tim--;
                document.getElementById("time").innerHTML = tim;
                if (tim <= 0) {
                    //clearInterval(timer);
                    CloudStatistics();
                    tim = again;
                }
            }, 1000);
        }
        countDown(60);

                                  

                     --谨记铭心

原文地址:https://www.cnblogs.com/xinloverong/p/6729267.html