Compare two password fields

zy_abc

Regular
Joined
May 2, 2003
Messages
67
I am comparing two password fields using javascript. But i am not able to do so. Can you please help me out and tell me where have i gone wrong.

Code:
function chked()
{
    var error=0;
    name1=document.form1.newpass.value;
    name2=document.form1.confirmpass.value;
    if (name1 != name2) 
    {
         alert ("\nThe entries do not match. Please re-enter.")
         return false;
    }
    else 
        return true;
    
    
}
 
Back
Top