The problem with the Gatekeeper password protection script is that, if the password is entered incorrectly, a "404 File Not Found" message appears, which rather gives the game away. This script uses the same basic method, that of the password being the same as the file name, minus the ".htm/l" extension, but also adds a small .gif file of the same name. The script attempts to load that .gif in place of an existing graphic, and if it fails, a JavaScript error message is generated. If the browser does not support the image object, the script works as before, and a 404 message appears. Many thanks to Bert Weaver for working out a fix for this script so that it works in both Internet Explorer and Netscape. It doesn't seem to work in Opera, though.
The password in this example is "target" (without the quotes).