Validation in HTML Form :: How to Apply Validation in Html Form

<html>
<head>
<title>Validation </title>

<script language="javascript">

function validate1()
{
    if(myfrm.txtuname.value=="")
    {
        alert("Please Enter Username.. ");
    }

    else if(myfrm.txtpass.value=="")
    {
        alert("Please Enter Password.. ");
    }

    else
    {
        alert("Login Successfully.. ");
    }
}
</script>
</head>
<body>

<form name="myfrm"> <table width="35%"> <tr>
<td> User Name : </td>
<td> <input type="text" name="txtuname"> </td>
</tr>

<tr>
<td> Password : </td>
<td> <input type="password" name="txtpass" maxlength="8"> </td>
</tr>

<tr>
<td> &nbsp; </td>
<td> <input type="submit" value=" Log in " onclick="validate1();"> &nbsp; <input type="reset" value=" Cancel ">
</td>
</tr>

</table>
</form>
</body>
</html>
Validation in HTML Form :: How to Apply Validation in Html Form Validation in HTML Form :: How to Apply Validation in Html Form Reviewed by Unknown on 7:37:00 PM Rating: 5

1 comment:

Powered by Blogger.