Tuesday, 25 August 2015

Match Password Validation (Contain char, digit and special symbol with 8 to 20 lenghts) using Java Script

HTML File
  
   
  <div class="lbl">Password : </div>
  <div class="ctrl" style="float: left;">
       <input type="password" name="pwd">
       <span id ="err_pword"></span>
  </div>
            </br></br>
   <div class="lbl">Retype Password : </div>
   <div class="ctrl" style="float: left;">
        <input type="password" name="rpwd">
        <span id ="err_rpword"></span>
   </div>
  
Java Script File
  
   
function rpwd_validation(rpwd)
{
    var pwd = document.registration.pwd;
    if (pwd.value == rpwd.value)
        {
            document.getElementById("err_rpword").innerHTML = "";
            return true;
        }
        else
        {
            document.getElementById("err_rpword").innerHTML = "Password does not match...";
            rpwd.focus();
            return false;
        }
}
  

No comments:

Post a Comment