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

Home
JavaScript DHTML
1.Ajax Layer
2.Data Type
3.Date Time
4.Development
5.Document
6.Dojo toolkit
7.Event
8.Event onMethod
9.Ext JS
10.Form Control
11.GUI Components
12.HTML
13.Javascript Collections
14.Javascript Objects
15.Javascript Properties
16.jQuery
17.Language Basics
18.Mochkit
19.Mootools
20.Node Operation
21.Object Oriented
22.Page Components
23.Rico
24.Scriptaculous
25.Security
26.SmartClient
27.Style Layout
28.Table
29.Utilities
30.Window Browser
31.YUI Library
JavaScript DHTML » Form Control » Form Validation 
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.