function send_code(i) {
var tel_str = $("#per_tel" + i + "").val();
var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
if (!myreg.test(tel_str)) {
alert("请填写手机号")
$("#per_tel" + i + "").focus();
return false;
}
settime(i, 60);
}
function settime(i, secodes) {
var countdown = secodes;
if (countdown == 0) {
$("#request_code" + i + "").attr('disabled', false);
$("#request_code" + i + "").text("获取验证码");
countdown = 60;
return;
} else {
$("#request_code" + i + "").attr('disabled', true);
$("#request_code" + i + "").text("重新发送(" + countdown + "秒后)");
countdown--;
}
setTimeout(function() {
settime(i, countdown)
}, 1000)
}
网友评论