短信倒计时 demo

function getCodeBtnChange(btn, _resetTitle, _resetFunction) {
    var waitTime = 3;
    var _gocartoon;
    btn.html('重新发送(' + waitTime + ')S');
    btn.unbind('click');
    btn.addClass('sel');
    var _gotime = function () {
        waitTime -= 1;
        btn.html('重新发送(' + waitTime + ')S');
        if (waitTime === 0) {
            clearInterval(_gocartoon);
            btn.html(_resetTitle);
            btn.click(_resetFunction);
            btn.removeClass('sel');
        }
    };
    _gocartoon = setInterval(_gotime, 1000);
}

你可能感兴趣的:(短信倒计时 demo)