|
Password Protect >>>
If you want to "protect" a site and don't have CGI access, you can try this JavaScript. Visitors get three tries to enter the correct password then they are refused entry. Note: The password is: password.
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/javascript">
function
password()
{
var
testV =
1;
var
pass1 =
prompt('Please
Enter Your Password','');
while
(testV
<
3)
{
if
(!pass1)
history.go(-1);
if
(pass1
==
"password")
{
alert('You
Got it Right!');
window.open('protectedpage.html');
break;
}
testV+=1;
var
pass1 =
prompt('Access
Denied - Password Incorrect, Please Try Again.','Password');
}
if
(pass1!="password"
&
testV ==3)
history.go(-1);
return
" ";
}
</script>
<center>
<FORM>
<input
type="button"
value="Enter
Password Protected Area"
onClick="password()">
</FORM>
</center>
|
|