Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Password | Q152 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.