JavaScript user Registration Password Strength verifier

Source: Internet
Author: User

<!doctype HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ""
< Meta http-equiv= "Content-type" content= "text/html;" charset=gb2312 "/>

<script language= "JavaScript Tutorial" >
Password
var Tmp=document.regform.u_password.value;
if (Tmp.length < 6) {
Alert ("Hint: password length must be greater than 6");
Document.regform.u_password.focus ();
return false;
}
if (Tmp.length <6) {//&&/^d+$/.test (TMP)
Alert (hint: password is too simple, set a combination of letters, numbers, or symbols.) ");
Document.regform.u_password.focus ();
return false;
}
if (Document.regform.u_password2.value!= document.regform.u_password.value) {
Alert ("Hint: two times password inconsistency");
Document.regform.u_password2.focus ();
return false;
}
</script>


<body>

<form id= "Form1" Name= "RegForm" method= "POST" action= "" >
<label>
Enter Password:
<input type= "Password" name= "U_password"/>
Confirm Password:
<input type= "Password" name= "U_password2"/>
</label>
<label>
<input type= "Submit" name= "Submit" value= "Validation" onclick= "Checkpass ();" />
</label>
</form>


</body>

Related Article

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.