burkem
Feb 23rd 2009, 1:03 am
Hi all
I need some help to make this script work. I want to allow a user to enter a designated password to alow them access to a particular webpage that open once they have entered the correct password I realise that it isnt the most secure password protection but that doesnt matter, its just a bit of a deterant only, I quite new to Javascript, so i really need some help.
What code should I enter in the if statement to open a particular webpage.
My codes below.
Thanks
Mark
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
<!--
function Validate()
{
var valid=false;
var password=document.forms[0].elements[0].value;
if(password==keepout)
alert("Wecome to my private stuff");
valid=true;
} else
{
alert("You do not have access to my private stuff");
}
return valid;
//-->
</script>
</head>
<body>
<form method="post" onsubmit="return Validate()">
<label><strong>Please Enter Password:
</strong>
<input name="Password" type="password" size="10" maxlength="10">
</label>
<br>
<label></label>
<p>
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
<label>
<input type="reset" name="Clear" value="Clear" />
</label>
</p>
</form>
<p> </p>
</body>
</html>
I need some help to make this script work. I want to allow a user to enter a designated password to alow them access to a particular webpage that open once they have entered the correct password I realise that it isnt the most secure password protection but that doesnt matter, its just a bit of a deterant only, I quite new to Javascript, so i really need some help.
What code should I enter in the if statement to open a particular webpage.
My codes below.
Thanks
Mark
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
<!--
function Validate()
{
var valid=false;
var password=document.forms[0].elements[0].value;
if(password==keepout)
alert("Wecome to my private stuff");
valid=true;
} else
{
alert("You do not have access to my private stuff");
}
return valid;
//-->
</script>
</head>
<body>
<form method="post" onsubmit="return Validate()">
<label><strong>Please Enter Password:
</strong>
<input name="Password" type="password" size="10" maxlength="10">
</label>
<br>
<label></label>
<p>
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
<label>
<input type="reset" name="Clear" value="Clear" />
</label>
</p>
</form>
<p> </p>
</body>
</html>