var = ["弱","中","强","超强"]; function checkStrong(val) { var modes = 0; if (val.length < 6) return 0; if (/\d/.test(val)) modes++; //数字 if (/[a-z]/.test(val)) modes++; //小写 if (/[A-Z]/.test(val)) modes++; //大写 if (/\W/.test(val)) modes++; //特殊字符 if (val.length > 12) return 4; return modes; }