<button type="button" name="button">点击获取验证码</button>
$("button[name='button']").click(function(event) {
//这里写发送验证码的代码
var time = 60;
settime($(this));
function settime(obj){
if (time==0) {
$(obj).attr('disabled', false);
$(obj).html("点击获取验证码");
time = 60;
return;
} else{
$(obj).attr('disabled', true);
$(obj).html(time+"秒后重新发送");
time--;
}
setTimeout(function() {
settime(obj)
},1000)
}
});
网友评论