发送验证码倒计时60s

var wait=60;
function time(o) {
        if (wait == 0) {
            o.removeClass("gray");
            o.text("发送验证码");
            wait = 60;
            
        } else {
            o.addClass("gray");
            o.text("重新发送(" + wait + ")s");
            wait--;
            setTimeout(function() {
                time(o)
            },
            1000)
        }
    }

 

posted @ 2017-10-14 10:47  boyanh  阅读(169)  评论(0编辑  收藏  举报