Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q152 How do I protect documents so that they are only accessible after entering the correct user id and password?

You are here: irt.org | FAQ | JavaScript | Password | Q152 [ previous next ]

Below follows some JavaScript that should do the trick, it uses the http://www.xxx.yyy/USERID/PASSWORD.htm format:

<SCRIPT LANGUAGE="JavaScript"><!--
function go() {
    location.href = 'http://www.xxx.yyy/' + document.passwordForm.userid.value + '/' + document.passwordForm.password.value + '.htm';
    return false;
}
//--></SCRIPT>

<FORM NAME="passwordForm" onSubmit="return go()">
<P>Enter userid: <INPUT NAME="userid" TYPE="TEXT">
<P>Enter password: <INPUT NAME="password" TYPE="PASSWORD">
<INPUT TYPE="BUTTON" VALUE="Enter" onClick="go()">
</FORM>

©2016 Martin Webb