Friday, 31 May 2013

Javascript code to match password and re-enter password

Simple Javascript Code to match password and confirm password



CODE :


<script>
function check()
{
  if(document.f1.pwd.value != document.f1.cpwd.value)
  {
  document.getElementById("res").innerHTML="<font color='red'>pwd and cpwd does not match</font>";
  }
  else
  {
  document.getElementById("res").innerHTML="<font color='green'>pwd and cpwd are matched</font>";
  }
}
</script>

<h2>Password And Confirm Password Match Tutorial</h2>

<form action="" method="post" name="f1">
<p>User Password : <input type="password" name="pwd" placeholder='enter password'></p>
<p>Re-enter Password : <input type="password" name="cpwd" placeholder="re-enter password" onkeyup="check()">&nbsp;&nbsp;<span id="res"></span></p>
</form>


For maore tutorials vasit on blog phpedu108.blogspot.in


Ouput Of Above Code

Password And Confirm Password Match Tutorial

User Password :

Re-enter Password :   





No comments:

Post a Comment