jq 两种倒计时


第一种:

        //暂停时间
        var delay = (function () {
            var timer = 0;
            return function (callback, time) {
                clearTimeout(timer);
                timer = setTimeout(callback, time);
            };
        })();

        //5秒后停止下注
        delay(function () {
            var i=0;
            var oTd = document.getElementById('td1');
            var children = oTd.children;
            for(i = 0; i < children.length; i++) {
                children[i].disabled=true;
                children[i].style.backgroundColor = "#EEEEEE";
            }
        }, 5000);

第二种:

        Surplustime(5);
        // 下注倒计时函数
        function Surplustime(seconds){
            if(seconds == 0){
                clearTimeout(timer);
                Pushtime(5);
                return;
            }
            // seconds--;
            $('.timetxt').text('开始倒计时:');
            $('.overtime').text((seconds) + '秒后 停止下注');
            var timer = setTimeout(function(){
                Surplustime(seconds);
            },1000);
            seconds--;
        }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM