Cell phone Send SMS JS verification

Source: Internet
Author: User

1     functionTJ () {2         varPhone = jQuery (' #phone '). Val ();3         varCode = jQuery (' #verificationcode '). Val ();4         varPassword = jQuery (' #password '). Val ();5         varRpassword = JQuery (' #rpassword '). Val ();6         varType = "Account Opening";7         if(Phone.length = = 0 | | phone = = "Please enter your mobile number") {8Alert ("Your phone number cannot be empty!") ");9JQuery (' #phone '). focus ();Ten             return false; One         } A         if(Phone.length > 0) { -             varAB =/^ (13[0-9]|15[0-9]|18[0-9]) \d{8}$/; -             if(ab.test (phone) = =false) { theAlert ("Your phone number is not correct!") "); -JQuery (' #phone '). focus (); -                 return false; -             } +         } -         if(Code.length = = 0 | | code = = ' Please enter your phone verification code ')) { +Alert ("Your phone verification code cannot be empty!") "); AJQuery (' #verificationcode '). focus (); at             return false; -         } -         if(Password.length = = 0 | | password = = ' Please enter 6-12-digit password ') { -Alert ("Your password cannot be empty!") "); -JQuery (' #password '). focus (); -             return false; in         } -         if(Password.length < 6 | | password.length > 12) { toAlert ("Password is 6-12 bits!") "); +JQuery (' #password '). focus (); -             return false; the         } *         if(Rpassword.length = = 0 | | rpassword = = ' Please re-enter password ') { $Alert ("Duplicate password cannot be empty!") ");Panax NotoginsengJQuery (' #rpassword '). focus (); -             return false; the         } +         if(Rpassword! =password) { AAlert ("Two times input password is inconsistent!") "); theJQuery (' #rpassword '). focus (); +             return false; -         } $  $ Jquery.ajax ({ -Type: "POST", -URL: "/kzh/addkzhdata", theData: "phone=" + Phone + "&code=" + code + "&password=" + password + "&type=" + type + "&t=" +NewDate (). toString (), -Successfunction(Result) {Wuyi                 if(Result = = "0") { theAlert ("Your phone verification code is not correct!") "); -JQuery (' #verificationcode '). focus (); Wu                     return false; -                 } About                 Else if(Result = = "1") { $JQuery (' #phone '). Val (""); -JQuery (' #verificationcode '). Val (""); -JQuery (' #password '). Val (""); -JQuery (' #rpassword '). Val (""); AAlert ("Your information has been submitted, the customer service staff will contact you as soon as possible"); +Window.location.href = "Http://www.jfinfo.com"; the                 }  -                 Else if(result== "Yes") { $$ ("#tc"). Show (); the                 } the  the             }, theErrorfunction(Result) { -Alert ("Access Error! "); in             } the         }); the     } About  the$(function(){ the$ ("#tc a.close"). Click (function(){ the$ ("#tc"). Hide (); +         }) -     }) the BayiDocument.onkeydown =function(event) { the         varE = Event | | window.event | | Arguments.callee.caller.arguments[0]; the         if(e && E.keycode = = 13) {//Enter key - TJ (); -         } the     }; the  the     functionGetCode () { the         varPhone = jQuery (' #phone '). Val (); -         if(Phone.length = = 0 | | phone = = "Please enter your mobile number") { theAlert ("Your phone number cannot be empty!") "); theJQuery (' #phone '). focus (); the             return false;94         } the         if(Phone.length > 0) { the             varAB =/^ (13[0-9]|15[0-9]|18[0-9]) \d{8}$/; the             if(ab.test (phone) = =false) {98Alert ("Your phone number is not correct!") "); AboutJQuery (' #phone '). focus (); -                 return false;101             }102         }103 104 Jquery.ajax ({ theType: "POST",106URL: "/kzh/getcode",107Data: "phone=" + Phone + "&t=" +NewDate (). toString (),108Successfunction(rval) {109                 if(Rval = = "0") { theAlert ("Your profile has been submitted, the customer service staff will contact you as soon as possible!") ");111}Else if(Rval = = "1") { theAlert ("The message has been sent, please check!") ");113                     varCount = 60;  the                     varCountdown = SetInterval (Countdown, 1000);  the                     varTimeshow = $ (". Hqbtn") the                     functioncountdown () {117Timeshow.removeattr ("Disabled");118                                    //Timeshow.val (count + seconds after resend); 119Timeshow.addclass ("Btn_hui"). Val (Count + "second Fetch"). attr ("Disabled", "true"); -                                     if(count = = 0) { 121Timeshow.removeclass ("Btn_hui"). Val ("Get Verification Code"). Removeattr ("Disabled");122 clearinterval (countdown);123                                     }124count--;  the                               }126                     }127             }, -Errorfunction(Result) {129Alert ("Access Error! "); the             }131         }); the}

Cell phone Send SMS JS verification

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.