废话不多说,直接上代码
function settime($obj,time) {
if (time == 0) {
$obj.attr("disabled",false);
$obj.css("background","#f38401").css("cursor","pointer");
$obj.text("获取手机验证码");
return;
} else {
$obj.attr("disabled",true);
$obj.css("background","#ccc").css("cursor","not-allowed");
$obj.text("重新发送(" + time + ")");
time--;
}
setTimeout(function () { settime($obj,time) },1000)
}
if (time == 0) {
$obj.attr("disabled",false);
$obj.css("background","#f38401").css("cursor","pointer");
$obj.text("获取手机验证码");
return;
} else {
$obj.attr("disabled",true);
$obj.css("background","#ccc").css("cursor","not-allowed");
$obj.text("重新发送(" + time + ")");
time--;
}
setTimeout(function () { settime($obj,time) },1000)
}
以上这篇JS 60秒后重新发送验证码的实例讲解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。