You are here: irt.org | FAQ | JavaScript | Password | Q1329 [ previous next ]
Try:
<form> Enter Password: <input name="P1" type="password" value=""> Verify Password: <input name="P2" type="password" value=""> <input type="button" onClick="if (this.form.P1.value != '' && this.form.P2.value != '' && this.form.P1.value == this.form.P2.value ) alert('Passwords match'); this.form.submit(); } else { alert('Passwords do not match'); this.form.P1.focus(); }"> </form>