Sunday 20 January 2013

Validation for Password and Confirm Password in java script


///Validation for Password and Confirm Password in java script


<html>
<head>
<title>Validation for Password and Confirm Password </title>
<script>
    function fun() {
        var a = document.f1.elements.pass1.value;
        var b = document.f1.elements.pass2.value;
        if (a != b) {
            alert("Password Dont match");
        }
        else {
            alert("Password match");
        }
    }
</script>
<body>
<form method="post" action="1.html" name="f1">
<table width="400px" border="5px">

<tr><td>Password:</td><td><input type="password" name="pass1"/></td></tr>
<tr><td>Confirm Password:</td><td><input type="password" name="pass2"/></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="submit" onClick="fun()" /></td><tr>


</table>
</form>

</body>
</html>




0 comments:

Post a Comment