Script Categories













Password Protect >>> Three Tries.

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">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
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!');

<!-- STEP TWO: Change protectedpage.html to your protected page  -->

//  Change the following URL to your protected filename

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 " ";
}
// End -->
</script>
<center>
<FORM>
<input
type="button" value="Enter Password Protected Area" onClick="password()">
</FORM>
</center>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

Macho Man dung nhu the nao


©