Script Categories

Password Protect >>> Multiple Users.

Rather not have one password for access the Members-Only section of your site? Well, along comes this little JavaScript gem. You can set up a separate username and password for as many members as you want, and even give each a different page to go to after logging in!

Members-Only Area!

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function Login(){
var done=0;
var username=document.login.username.value;
var password=document.login.password.value;
if (username=="member1" && password=="password1") { window.location="page1.html"; done=1; }
if (username=="member2" && password=="password2") { window.location="page2.html"; done=1; }
if (username=="member3" && password=="password3") { window.location="page3.html"; done=1; }
if (done==0) { alert("Invalid login!"); }
// End -->
<form name=login>
<table width=225 border=1 cellpadding=3>
colspan=2><center><font size="+2"><b>Members-Only Area!</b></font></center></td></tr>
Username:</td><td><input type=text name=username></td></tr>
Password:</td><td><input type=text name=password></td></tr>
colspan=2 align=center><input type=button value="Login!" onClick="Login()"></td></tr>

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!).