js手机短信按钮倒计时

/*
   120秒手机短信按钮倒计时
   */
    exports.sendmessage = function (name) {
        var second = 120;

$(name).attr("disabled", true);
        var color = $(name).css('background-color');
        $(name).attr("style", "background-color : #c1c1c1");

function update(num) {
            if (num == second) {
                $(name).attr("style", "background-color : "+color);
                $(name).text("获取验证码");
                $(name).attr("disabled", false);
            }
            else {
                var printnr = second - num;
                $(name).text(printnr + "秒后获取");
            }
        }
        function uupdate(i) {
            return function () {
                update(i);
            }
        }
        for (var i = 1; i <= second; i++) {
            setTimeout(uupdate(i), i * 1000);
        }
    }

上一篇:Android查询系统的音频(音乐播放器的核心)


下一篇:mongodb根据字符长度作为条件查询