0
我有一個JavaScript代碼whch只驗證密碼的整數。我想要的只是開發「var exp」的代碼,密碼必須是大寫字母,小寫字母,數字字符和特殊字符的組合。Javascript密碼長複雜驗證
HTML代碼工作完美..
//Empty Validation//
function isEmpty(elemValue, field) {
if (elemValue == "" || elemValue == null) {
alert(field + " must not be empty!");
return true;
} else {
return false;
}
}
//empty validation end//
//password validation//
function pwValidation(elemValue) {
if (!isEmpty(elemValue, "Password")) {
if (elemValue.length >= 8) {
var exp1 = /^[0-9]+$/;
if (elemValue.match(exp1)) {
return true;
} else {
alert("Password must contain Upper, lower case, number and at least a special character");
return false;
}
} else {
alert("Password must at least 8 characters!");
}
} else {
return false;
}
}
//password validation end//