Protect a file in Java Script

 Protect a file using Login ID and Password.

 <html>
<head>

<script language="JavaScript">
function checkLogin(x)
{
if ((x.id.value != "Sam")||(x.pass.value !="Sam123"))
{
alert("Invalid Login");
return false;
}
else
location="main.htm"
}
</script>

</head>
<body>
<form>
<p>
UserID:<input type="text" name="id"></p>
<p>
Password:<input type="password" name="pass"></p>
<p>
<input type="button" value="Login" onclick="checkLogin(this.form)"></p>
</form>
</body>
</html>

0 comments :

Post a Comment

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger