Wednesday, 28 March 2012

Password Matching matching code in javascript


function CheckPwd()
{
var fpwd = document.getElementById("TxtRegPwd1").value;
var ConfmPwd = document.getElementById("TxtRegPwd2").value;

        if(fpwd != ConfmPwd)
        {
         alert('Password did not match !');
         document.getElementById("TxtRegPwd1").value = "";
         document.getElementById("TxtRegPwd2").value = "";
         document.getElementById("TxtRegPwd1").focus();
        
         return false;
        }

}
function CheckPwd2()
{
var fpwd = document.getElementById("TxtRegPwd1").value;
var ConfmPwd = document.getElementById("TxtRegPwd2").value;

if (ConfmPwd != "")
    {
        if(fpwd != ConfmPwd)
        {
         alert('Password did not match !');
         document.getElementById("TxtRegPwd1").value = "";
         document.getElementById("TxtRegPwd2").value = "";
         document.getElementById("TxtRegPwd1").focus();
        
         return false;
        }
     }
}

No comments:

Post a Comment