function CharMode(iN){
if (iN>=65 && iN <=90) //大写字母
return 2;
if (iN>=97 && iN <=122) //小写
return 4;
else
return 1; //数字
}
//计算出当前密码当中一共有多少种模式
function bitTotal(num){
modes=0;
for (i=0;i<3;i++){
if (num & 1) modes++;
num>>>=1;
}
return modes;
}
//checkStrong函数 返回密码的强度级别
function checkStrong(sPW){
Modes=0;
for (i=0;i<sPW.length;i++){
//测试每一个字符的类别并统计一共有多少种模式.
Modes|=CharMode(sPW.charCodeAt(i));
}
var btotal = bitTotal(Modes);
if (sPW.length >= 10) btotal++;
switch(btotal) {
case 1:
return "<table width=’130′ class=’pswstrong’><tr><td bgcolor=’#FE707E’><strong>弱</strong></td><td><span style=’color:#666;’>中</span></td><td><span style=’color:#666;’>强</span></td></tr></table>";
break;
case 2:
return "<table width=’130′ class=’pswstrong’><tr><td bgcolor=’#FCFA93′><span style=’color:#666;’>弱</span></td><td bgcolor=’#FCFA93′><strong>中</strong></td><td><span style=’color:#666;’>强</span></td></tr></table>";
break;
case 3:
return "<table width=’130′ class=’pswstrong’><tr><td bgcolor=’#BDFEA6′><span style=’color:#666;’>弱</span></td><td bgcolor=’#BDFEA6′><span style=’color:#666;’>中</span></td><td bgcolor=’#BDFEA6′><strong>强</strong></td></tr></table>";
break;
default:
return "<font color=’#33CC00′>强</font>";
}
}
function ShowStrong(obj,oMsg,status){
var obj = oo(obj);
if(status==1){
obj.innerHTML = oMsg
}else{
obj.innerHTML = ""
}
}