Use JavaScript to check the password input : Form Validation « Form Control « JavaScript DHTML






Use JavaScript to check the password input

  


<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function sendMe()
{
    return confirm("Continue?");
}

function chkForm()     
{
    if (form1.pass1.value != form1.pass2.value)
    {
        alert("Password does not match");
        form1.pass1.value = "";
        form1.pass2.value = "";
        form1.pass1.focus();
        return false;
    }
}
</script>
</head>
<body>
<form name="form1" method="POST" action="someCGI.cgi" onSubmit="return sendMe()">
<p>Enter you password: <input type="password" name="pass1"><br>
Re-enter you password: <input type="password" name="pass2"><br>
<input type="submit" value="Submit" onClick="return chkForm()">
<input type="reset" value="Reset"></p>
</form>
</body>
</html>

   
    
  








Related examples in the same category

1.Form Validator: time, date email, phone number, age etc
2.Form Validate: is blank, is digit and is integer
3.Log in form validation
4.Log in email validation
5.Comprehensive form validation
6.Illegal sub string validation
7.Email form validation
8.Form Validator
9.Form valiation for empty data, file name
10.Email Address Validate
11.Time Validate
12.URL Validate
13.Form value validation and onsubmit action
14.Check form input value and alert user by change the control background