The strength verification of JS Common password and the judgement function of uppercase and lowercase letters
*/
function Charmode (in) {
if (in>=65 && in <=90)//Uppercase
return 2;
if (in>=97 && in <=122)//lowercase
return 4;
Else
return 1; Digital
}
Calculates how many patterns there are in the current password
function Bittotal (num) {
modes=0;
for (i=0;i<3;i++) {
if (num & 1) modes++;
num>>>=1;
}
return modes;
}
Checkstrong function returns the strength level of the password
function Checkstrong (SPW) {
modes=0;
for (i=0;i<spw.length;i++) {
Test the category of each character and count how many patterns there are.
Modes|=charmode (Spw.charcodeat (i));
}
var btotal = bittotal (modes);
if (spw.length >=) btotal++;
Switch (btotal) {
Case 1:
Return "<table width= ' 130 ' class= ' PS tutorial wstrong ' ><tr><td bgcolor= ' #fe707e ' ><strong> weak </ Strong></td><td><span style= ' color: #666; ' > </span></td><td><span style= ' color: #666; ' > Strong </span></td></tr></table> ";
Break
Case 2:
Return "<table width= ' 130 ' class= ' Pswstrong ' ><tr><td bgcolor= ' #fcfa93 ' ><span style= ' color: #666 ;' > Weak </span></td><td bgcolor= ' #fcfa93 ' ><strong> in </strong></td><td> <span style= ' color: #666; ' > Strong </span></td></tr></table> ";
Break
Case 3:
Return "<table width= ' 130 ' class= ' Pswstrong ' ><tr><td bgcolor= ' #bdfea6 ' ><span style= ' color: #666 ;' > Weak </span></td><td bgcolor= ' #bdfea6 ' ><span style= ' color: #666; ' > </span></td><td bgcolor= ' #bdfea6 ' ><strong> strong </strong></td></tr> </table> ";
Break
Default
Return "<font color= ' #33cc00 ' > Strong </font>";
}
}