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