Verify the password strength on the client and be compatible with Firefox and IE
Source: Internet
Author: User
0. The password is empty.
1. The password must be less than six characters in length, or only one combination of passwords
2. The password is more than five characters long and can be combined into two types.
3.The password must be more than five characters long and can be combined into three types.
4.The password is more than five characters long and can be combined into four types.
< Script Language = " Javascript " >
Function Evaluatepassword (word)
{
If (Word = "" )
{
Return 0 ;
}
Else If (Word. Length < 6 )
{
Return 1 ;
}
Else
{
Return Word. Match ( / [ - Z] ( ?! [ ^ A - Z] * [ - Z]) | [ - Z] ( ?! [ ^ A - Z] * [ - Z]) | \ D ( ?! [ ^ \ D] * \ D) | [ ^ A - Za - Z \ D] ( ?! [ - Za - Z \ D] * [^ - Za - Z \ D]) / G). length;
}
}
VaR Test = New Array ( "" , " A_1 _ " , " Abcdef " , " Abcde123 " , " Ads23 % " , " Aa1b2 ^ & 2 " );
For ( VaR I In Test)
{
Document. Write (test [I] + " The password strength is " + Evaluatepassword (test [I]) + " <Br> " );
}
</ Script >
From http://www.cnblogs.com/0009/
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