Your name: Choose a password: Verify password:
Here is the code:
<html> <head> <script> function validForm(passForm) { if (passForm.passwd1.value == "") { alert("you must enter a password"); passForm.passwd1.focus(); return false; } if (passForm.passwd1.value != passForm.passwd2.value) { alert("Entered passwords did not match"); passForm.passwd1.focus(); passForm.passwd1.select(); return false; } return true; } </script> <title>Password Validation</title> </head> <body bgcolor="#FFFFFF"> <form name="form" action="passwordvalidation.asp" onsubmit="return validForm(this)"> Your name: <input type="text" name="textfield"> <BR> Choose a password: <input type="password" name="passwd1"> <BR> Verify password: <input type="password" name="passwd2"> <BR> <input type="submit" value="Submit" name="submit"> <input type="reset"> </body> </html>