我想驗證密碼的Javascript功能來驗證密碼
<form name="regist" action="proc/regist.php" onsubmit="return validate_form1()" method="post">
<p>Your Username: <input type="text" name="regist_name" /></p>
<p>Your Password: <input type="password" name="regist_password1"/> at least 6 characters</p>
<p>Repeat Password: <input type="password" name="regist_password2" /></p>
<input type="submit" value="Register NOW">
的輸入我想設定的功能是這樣的:
function validate_form1(){
if(regist_password1.length<6){
alert("Your password is too short , please try again!");
return false;
}
}
也許問題出在「regist_password1.length」。