验证密码必须是字母加数字的组合
function validPsw(password) {
var num = 0;
var number = 0 ;
var letter = 0 ;
var bigLetter = 0 ;
var chars = 0 ;
if (password.search(/[0-9]/) != -1) {
num += 1;
number =1;
}
if (password.search(/[A-Z]/) != -1) {
num += 1;
bigLetter = 1 ;
}
if (password.search(/[a-z]/) != -1) {
num += 1;
letter = 1 ;
}
if(number>=1&&(bigLetter+letter<=0)){
alert("不能全为数字!");
}
if(number==0&&(bigLetter+letter>=1)){
alert("不能全为字母!");
}
var reg = /^[0-9a-zA-Z]+$/;
if(!reg.test(password)){
alert("密码只能由数字和字母组成");
}
}