+
95
-

回答

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>BFW NEW PAGE</title>
<script id="bfwone" data="dep=jquery.17&err=0" type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/bfwone.js"></script>
<script type="text/javascript">
function resetTime(e) {

var second = 60;
var timer = null;
timer = setInterval(function() {
second -= 1;
if (second > 0) {
$(e).attr('disabled', true);
$(e).val(second + "秒后重新点击");
} else {
clearInterval(timer);
$(e).attr('disabled', false);
$(e).val("获取验证码");
}
},
1000);
}
bready(function() {
$("#sendcode").click(function() {
//ajax发送逻辑
//发送成功后执行
resetTime("#sendcode");
});
});
</script>
<style>
</style>
</head>
<body>
<input type="button" id="sendcode" value="发送验证码" />
</body>
</html>

网友回复

我知道答案,我要回答