JavaScript Re-type Password Validation
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<!DOCTYPE html> <html> <head> <script> function pass_validation() { var firstpassword=document.f1.password1.value; var secondpassword=document.f1.password2.value; if(firstpassword==secondpassword){ return true; } else{ alert("Password does Not Match"); return false; } } </script> </head> <body> <form name="f1" action="/JavaScript/Index" onsubmit="return pass_validation()"> Password:<input type="password" name="password1" /><br/> Re-enter :<input type="password" name="password2"/><br/> <input type="submit"> </form> </body> </html> |