Home / Free JavaScripts / Password Protecting / Here

Cut & Paste Password Protect a page
Credit: Not indicated

Description: The below script will provide low level password protection to a page.

Example: (Enter "letmein" as password)

Directions: Simply cut and paste the following into the <body> tags of your page. To configure the password, change letmein. To change the password protected page (the target page), change protectpage.html.

function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
if (pass1.toLowerCase() == "letmein") {
alert('You Got it Right!');'protectpage.html');
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
if (pass1.toLowerCase()!="password" & testV ==3)
return " ";
<input type="button" value="Enter Protected Area" onClick="passWord()">

JavaScript Tools:
Site Info

CopyRight (c) 2015 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info