/*
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);
}
}