l--based on JS Self-registration page Verification Plugin

Source: Internet
Author: User

Introduced

Fully JavaScript-based authentication plug-in

JS Code
varRegistervalidate = (function () {    varValidateobj ={warninfo:"Please enter content as prompted", ErrorInfo:"You entered the wrong content, please follow the prompts to enter"    }; varRegistervalidate =function () {        /*----Phone number-------*/Validateobj={input:document.getElementsByTagName ("Input") [0], LabelP:document.getElementById ("Validate-phone"), regex:/^1\d{10}$/g, Warninfo:"Please enter 11-digit mobile phone number", ErrorInfo:"You entered the wrong mobile phone number, please check and re-fill"        };        Validate (Validateobj); /*-----Chaptcha--------*/Validateobj={input:document.getElementsByTagName ("Input") [1], LabelP:document.getElementById ("Validate-chaptcha"), regex:/^\d{6}$/g, Warninfo:"Please enter 6-digit verification Code", ErrorInfo:"The Verification code you entered is incorrect, please check and re-fill"        };        Validate (Validateobj); /*-----Password--------*/Validateobj={input:document.getElementsByTagName ("Input") [2], LabelP:document.getElementById ("Validate-password"), regex:/^\d{6}$/g, Warninfo:"Please enter a password for 6-16 digits and character combination", ErrorInfo:"You entered the wrong password, please check and re-fill"        };        Validate (Validateobj); /*------name-------*/Validateobj={input:document.getElementsByTagName ("Input") [4], LabelP:document.getElementById ("Validate-name"), regex:/^\d{6}$/g, Warninfo:"Please enter a 2-5-character name, 1 characters = 2 Bits", ErrorInfo:"The user name you entered is incorrect, please check and re-fill"        };        Validate (Validateobj); /*------ID Number----*/Validateobj={input:document.getElementsByTagName ("Input") [5], LabelP:document.getElementById ("Validate-idcard"), regex:/^\d{6}$/g, Warninfo:"Please enter a 2-5-character name, 1 characters = 2 Bits", ErrorInfo:"The user name you entered is incorrect, please check and re-fill"        };        Validate (Validateobj); Validateobj={input:document.getElementsByTagName ("Input") [6], LabelP:document.getElementById ("Validate-yhcard"), regex:/^\d{6}$/g, Warninfo:"Please enter the automatic Repayment bank card number", ErrorInfo:"The user name you entered is incorrect, please check and re-fill"        };    Validate (Validateobj);    }; /*-------Validation of common functions, 4 parameters 1. Generation verification input;2 output information label; 3. regular; 4.warnInfo; 5.erroInfo-----------*/    //input, Labelp, regex, Warninfo, Erroinfo    functionValidate (validateobj) {ValidateObj.input.onfocus=function() {            if(ValidateObj.input.value = = "") {ValidateObj.labelP.style.display= "Inline-block"; ValidateObj.labelP.innerHTML= ' <i class= ' validate_warn ' ></i><span> ' + validateobj.warninfo + ' </span> ';        }; } validateObj.input.onkeyup=function() {            varVallength = ValidateObj.input.value.replace (/[^\x00-xff]/g, "XX"). length; ValidateObj.labelP.innerHTML= ' <i class= "Validate_warn" ></i><span> current input bit De number ' +vallength+ ' </span> '; } ValidateObj.input.onblur=function () {            //var regex =/^1\d{10}$/g;            //var regex = new Regex ()            if(!validateObj.regex.test (ValidateObj.input.value)) {ValidateObj.labelP.innerHTML= ' <i class= ' validate_error ' ></i><span> ' + validateobj.errorinfo + ' </span> '; }Else{ValidateObj.labelP.innerHTML= ' <i class= ' validate_ok ' > '; }        }    }    returnregistervalidate;}) ();

l--based on JS Self-registration page Verification Plugin

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.