Script Categories

Forms >>> Password Verifier.

Keep your visitors from submitting their form until their "password" and "re-enter password" fields match, for verification purposes. They get an error message telling them to re-enter the passwords if they do not match.


Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function checkPw(form) {
pw1 = form.pw1.value;
pw2 = form.pw2.value;

if (pw1 != pw2) {
alert ("\nYou did not enter the same new password twice. Please re-enter your password.")
return false;
else return true;
// End -->
<form onSubmit="return checkPw(this)">

<table border=0>
Password:</td><td><input type=text name=pw1 size=10></td>
Re-enter:</td><td><input type=text name=pw2 size=10></td>
colspan=2 align=center><input type=submit value="Submit!"></td>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).