If a visitor wants to go a password protected page, they must first enter the correct password on the page with this script. This script will just take you to [password you enter].html. This program works as long as JavaScript is enabled and you have an index.html file in your directory. The password is the protected filename without the .html ending.
If you want to 'protect' a site and don't have CGI access, you can try this JavaScript. Visitors get three tries to enter the correct password then they are refused entry. The password of this example is: password.