Hi all,
I want to do some basic password validation when a user wants to change their password. The validation will be to check that the two password boxes match, which will be done dynamically with the result being shown in a div.
I can't get it to work, so I would appreciate any suggustions on how to do this.
Contents of my javascript file
function checkPass()
{
var newPassword = document.getElementById('newPassword.value');
var confirmPassword = document.getElementById('confirmPassword.value');
alert(newPassword);
if (newPassword ==confirmPassword)
{
document.getElementByID('password_result').innerHTML='Passwords Match!'
}
else
{
document.getElementbyId('password_result').innerHTML = "Passwords Do Not Match!"
}
Snip of the form where I am having this problem
<div id="passwordCheck">
<form name="password_form" action="" method="post">
Current Password: <input type=password name=currentPassword /><br />
New Password:<br />
<input type=password name=newPassword onKeyUp="checkPass()" />
<br />
Re-enter Password:<br />
<input type=password name=confirmPassword onKeyUp="checkpass()" />
<br />
<input type="submit" value="Submit"><input type="reset" value="Reset" />
<div id="password_result"> </div>
</form>
</div>
I look forward to any help given,
Cheers,