js倒计时

var wait = 60;
function time(b)
{
    if (wait == 0) {
        b.removeAttribute("disabled","disabled");
        b.removeAttribute('style','color:white');
        b.value="免费获取验证码";
        wait = 60;
    } else {
        b.setAttribute("disabled", "disabled");
        b.setAttribute('style','color:white');
        b.value="重新发送(" + wait + ")";
        wait--;
        setTimeout(function() {time(b)}, 1000)
    }
}

 

posted @ 2015-12-16 14:44  脉醉  阅读(112)  评论(0编辑  收藏  举报