使用setInterval设置多少秒重新发送验证码
setInterval() 方法可按照指定的周期(以毫秒计)来调用函数或计算表达式。setInterval() 方法会不停地调用函数,直到 clearInterval() 被调用或窗口被关闭才不调用
语法:
setInterval(function, milliseconds, param1, param2, ...)
var total = 30;
function timekeeping() {
var interval=setInterval(function(){
if(total==0){
clearInterval(interval);
$('#sendAuthCode').attr("disabled", false);
$('#sendAuthCode').attr("value",'发送验证码');
total = 30;
return;
} else {
$('#sendAuthCode').attr("disabled", true);
$('#sendAuthCode').attr("value",total + '秒后重发');
total--;
}
},1000);
}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有