JQuery源代碼:信息已發(fā)出,60秒后重新發(fā)送
HTML源代碼片斷:
HTML源代碼片斷:
<!--短信驗(yàn)證碼-->
<div class="vervode_main ovhide hide">
<div class="vercode_l fl">
<input type="number" style="border:1px solid #e1e1e1;" placeholder="短信驗(yàn)證碼" name="code" value="" regexp="^[0-9]{4,6}$">
<div class="code_error hide">
<i class="iconfont icon-pc-tishi"></i>
<span>請(qǐng)輸入正確驗(yàn)證碼</span>
</div>
</div>
<div class="vercode_r">
<button type="button" class="" id="sendCode" onclick="getVerify1()">獲取驗(yàn)證碼</button>
<div class="send_again hide"><span>60</span>s后重新發(fā)送</div>
</div>
</div>
JQuery源代碼片斷:
JQuery源代碼片斷:
<script>
var miao1 = 60;
var m1 = null;
var codeBtnObj1 = $("#sendCode");
var daojishi1 = function() {
clearInterval(m1);
if (miao1 == 0) {
codeBtnObj1.html('獲取驗(yàn)證碼');
miao1 = 60;
$("#sendCode").attr("onclick","getVerify1()");
} else {
miao1 = miao1 - 1;
codeBtnObj1.html(miao1 + 's后重新發(fā)送');
m1 = setInterval(daojishi1, 1000);
$("#sendCode").attr("onclick","getalert()");
}
};
function getalert() {
layer.alert('信息已發(fā)出,60秒后重新發(fā)送');
}
function getVerify1() {
var tel = $.trim( $("input[name=tel]").val() );
if(tel=='') {
layer.alert('請(qǐng)輸入手機(jī)號(hào)');
return;
}
$.ajax({
url: "http://k431ba.cn/sendmsgcode",
type: "POST",
data: {phone: tel},
dataType: "json",
success: function (data) {
if (data.status == 1) {
daojishi1();
} else {
alert(data.msg);
}
}
});
}
function guanbi() {
$("#gray").hide();
$(".login").hide();
}
function showlogin(){
$("#gray").show();
$(".login").show();
}
</script>
手機(jī)號(hào)驗(yàn)證,動(dòng)態(tài)監(jiān)測(cè)手機(jī)號(hào)源代碼片斷:
手機(jī)號(hào)驗(yàn)證,動(dòng)態(tài)監(jiān)測(cè)手機(jī)號(hào)源代碼片斷:
<script> /*手機(jī)號(hào)輸入監(jiān)控*/ function checkmobile(phone){ var myreg = /^1[3-9][0-9]{9}$/; if(myreg.test(phone)){ return true; }else{ return false; } } //輸入手機(jī)號(hào)時(shí),動(dòng)態(tài)監(jiān)測(cè)手機(jī)號(hào) $("input[name=tel]").on("keyup",function(){ if(checkmobile($(this).val())){ var phone=$(this).val(); $.ajax({ url: "/index.php/Index/checktel", type: "POST", data: {phone: phone}, dataType: "json", success: function (data) { if(data.status!=1){ if($(".vervode_main").hasClass("hide")){ $(".vervode_main").removeClass("hide"); } } } }); }else{ $(".vervode_main").addClass("hide"); } }) </script>