jquery phone Number Verify instance code

Source: Internet
Author: User
The code is as follows Copy Code

function Getverify () {
if ($ (' #regRuser '). Val ()) {
var m=$ (' #regRuser '). Val ();
if (/^13d{9}$/g.test (m) | | (/^15[0-35-9]d{8}$/g.test (m)) | | (/^18d{9}$/g.test (m))) {
var postdata = $ (' #reg_form '). Serialize ();
$.ajax ({
Type: "POST",
URL: "/ajax/getverify",
Data:postdata,
Success:function (msg) {
if (msg>0) {
Alert (' Verification code has been sent to your cell phone, please check ');
$ (' #getVerify '). Hide ();
$ ('. Regnav '). CSS (' background ', ' url (/static/images/v10/regnav2.png) ');
$ (' #checkvalidate '). Show ();
F_timeout ();
$ ('. ABC '). Show ();
}else if (msg==0) {
Alert (' Mobile number has been registered ');
}
}
});
}else{
Alert (' Please enter the correct phone number ');
}
}
}

function F_timeout () {

$ (' #timeb1 '). html (' <span id= "timeb2" after >60</span> seconds);
$ (' #timeb1 '). Click (function () {});
Timer = Self.setinterval (addsec,1000);

}

function Addsec () {

var t = $ (' #timeb2 '). html ();
Alert (t);
if (T > 0) {

$ (' #timeb2 '). HTML (t-1);
Alert (t);
}else{

Window.clearinterval (timer);
$ (' #timeb1 '). html (' <span id= ' timeb2 ' ></span> re-acquiring authentication code ');
$ (' #timeb1 '). Click (function () {getverify ();});
}

}

<form id= "Reg_form" name= reg_form "method=" POST "onsubmit=" return false; " >
<input value= "" Name= "Regcyqnumber" type= "hidden" id= "Regcyqnumber" >
<ul>
<li><span class= "Txt_name" > Mobile number: </span><input class= "Input_user" "autocomplete=" Off "onblur=" if (this.value== ') this.value= '; ' onfocus= ' if (this.value== ') this.value= '; "value=" "Name=" Regruser "type=" "Text" I D= "Regruser" ></li>
<li><span class= "Txt_name" > Verification Code: </span><span class= "code" onclick= "Getverify ();" Id= "Timeb1" style= "Cursor:pointer" > Free access to the authentication code </span><input class= "Input_code" "autocomplete=" Off "onblur=" if ( this.value== ') this.value= '; ' onfocus= ' if (this.value== ') this.value= '; ' value= ' type= ' text ' name= ' Verifycode ' ID = "Verifycode" ></li>
<li><span class= "txt_name" > Login password: </span><input class= "Input_user" "autocomplete=" Off "onblur=" if (this.value== ') this.value= '; ' onfocus= ' if (this.value== ') this.value= '; "value=" "id=" Regrpass "Name=" RegRpass "type=" Password "></li>
<li>

<span class= "Txt_name" > Verification Code:</span>
<div class= "Yz_code" >
<span class= "Code1" style= "Cursor:pointer" > </span>
<input class= "Input_yzcode" autocomplete= "Off" onblur= "if (this.value== ') this.value= '"; "onfocus=" if (this.value = = ') this.value= '; "value=" "type=" text "name=" SCODE "id=" SCODE ">
</div></li>

<li class= "Reg" style= "MARGIN-TOP:8PX;" >
<input type= "Submit" Name= "sub" class= "Button_reg" value= ""/>
</li>

<li><span class= "Hwlogin" > You are registered, <a href= "/reg/login" target= "_blank" > click Login </a>,<a href= " Reg "> Full registration </a></span></li>

</ul>
</form>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.