<div class="Mar">
<div class="input_content_title">
<span style="width: 1rem; color: #FD0000;">*</span>短信验证:
</div>
<div class="input_content_shu">
<div>
<input type="text" id="Code" name="Code" placeholder="请输入短信验证码" class="input_content_code" />
<input id="code" name="code" class="input_content_code_txt" value="获取验证码" onclick="clickButton(this)" readonly />
<div class="clear"></div>
</div>
</div>
</div>
<script>
$(function () {
$(".input_content_code_txt").click(function () {
var str_phone = $("#Phone").val();
var Vstr = /^[1][3|4|5|7|8][0-9]{9}$/;
if (str_phone == "") {
layer.msg('手机号码,不能为空');
return false;
}
if (!(Vstr.test(str_phone))) {
layer.msg('无效手机号');
return false;
}
$.post("handlers/RegisterVerification.ashx", { Phone: str_phone }, function (date) {
if (date == "1") {
layer.msg('发送成功!');
}
else {
layer.msg(date);
return false;
}
})
})
})
function clickButton(obj) {
var str_phone = $("#Phone").val();
var Vstr = /^[1][3|4|5|7|8][0-9]{9}$/;
if (str_phone == "") {
return false;
}
if (!(Vstr.test(str_phone))) {
return false;
}
var obj = $(obj);
obj.attr("disabled", "disabled");/*按钮倒计时*/
var time = 300;
var set = setInterval(function () {
obj.val(--time + "(s)");
}, 1000);/*等待时间*/
setTimeout(function () {
obj.attr("disabled", false).val("重新获取验证码");/*倒计时*/
clearInterval(set);
}, 300000);
}
</script>