<html>
<head>
<title></title>
<script type="text/javascript">
function validate()
{
var username=document.getElementById('txtname').value;
var password=document.getElementById('txtpass').value;
if(username=="abc" && password=="abc")
{
window.location="http://www.google.com";
}
else
{
alert("Login Failed");
document.getElementById("txtpass").value="";
document.getElementById("txtpass").focus();
}
}
</script>
</head>
<body>
<div>
<table>
<tr>
<td>
UserName
</td>
<td>
<input type="text" name="txtname" size="20" id="txtname"/>
</td>
</tr>
<tr>
<td>
Password
</td>
<td>
<input type="text" name="txtpass" size="20" id="txtpass" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="button" value="Submit" onclick="validate()" id="btnsubmit" />
</td>
</tr>
</table>
</div>
</body>
</html>
<head>
<title></title>
<script type="text/javascript">
function validate()
{
var username=document.getElementById('txtname').value;
var password=document.getElementById('txtpass').value;
if(username=="abc" && password=="abc")
{
window.location="http://www.google.com";
}
else
{
alert("Login Failed");
document.getElementById("txtpass").value="";
document.getElementById("txtpass").focus();
}
}
</script>
</head>
<body>
<div>
<table>
<tr>
<td>
UserName
</td>
<td>
<input type="text" name="txtname" size="20" id="txtname"/>
</td>
</tr>
<tr>
<td>
Password
</td>
<td>
<input type="text" name="txtpass" size="20" id="txtpass" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="button" value="Submit" onclick="validate()" id="btnsubmit" />
</td>
</tr>
</table>
</div>
</body>
</html>
No comments:
Post a Comment