Saturday, July 7, 2012

LoginPage Validation

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login Page</title>
<script type="text/javascript">
function validation()
{
    var ml="6";
    var mx="12";
    valid=true;
    if(document.login.name.value=="")
        {
        alert("Please enter yor user id");
        valid=false;
        }
    else if(document.login.pwd.value=="")
            {
            alert("Please enter a valid password");
            valid=false;
            }
     else if(document.login.pwd.value.length<ml)
        {
        alert("Password should be more than 6 charachters");
        valid=false;
        }
     else if(document.login.pwd.value.length>mx)
        {
        alert("Password should be less than 12 charachters");
        valid=false;
        }
   
    return valid;
}
</script>
</head>
<body bgcolor="pink" >
<center><h1 text="green">MULTIPLEX AUTOMATION SYSTEM</h1></center>
<marquee> Welcome to the world of Entertainment! Unlimited joy!</marquee>
<hr>
<form name="login" action="events_frame.html" method="post" onSubmit=" return validation()">
<center>
<fieldset>
<legend align="right">Login</legend>
<table>
<tr>
<td>User Id:</td>

<td><input type="text" name="name" size="30" id="1"/></td>
</tr>
<tr>
<td>Password :</td>
<td><input type="password" name="pwd" size="30"  id="2"></td>
<tr>
</tr>
<td><input type="submit" value="Submit"/></td>
<td><input type="reset" value="Reset"/></td>
</tr>
</table>
<a href="forgotpassword.html">Forgot Userid/Password?</a>
</center>
</fieldset>
</form>
</body>
</html>

No comments:

Post a Comment