获取短信验证码倒计时
作者:chrispy
//获取短信验证码倒计时60秒var countdown = 60;function settime(obj) { if (countdown == 0) { obj.css({'background':'#ccc'}); obj.removeAttr("disabled"); obj.val("获取"); countdown = 60; return; } else
//获取短信验证码倒计时60秒
var countdown = 60;
function settime(obj) {
if (countdown == 0) {
obj.css({'background':'#ccc'});
obj.removeAttr("disabled");
obj.val("获取");
countdown = 60;
return;
} else {
obj.css({'background':'#ddd'});
obj.attr("disabled", true);
obj.val(countdown + "秒");
countdown--;
console.log(countdown);
}
setTimeout(function() {
settime(obj)
},1000)
}