JavaScript. Password protect your site

I received a question this week asking how to Password Protect a
Web Page. There are several methods that can be used to do this.
One of the simplest is to use a JavaScript. Using JavaScript in
your web pages is a topic I don't think I have addressed before.
There are many useful JavaScripts available that can be easily
added to your Web Pages. I thought it may be useful for many of
you to learn how to use them.

For those of you that are not familiar with it, JavaScript is a Run
Time scripting language specifically designed for use in Web
Pages. That basically means that you don't have to compile, link
and embed it, processes which can be very complicated for none
programmers. JavaScript's real advantage for most Web
Designers is that it can be quickly learned and easily used.

What is the difference between JavaScript and Java?

They are actually quite different. Java is an Object Oriented
programming language that is written, compiled and executed
independently of a Web Page. To use a Java applet (which
means a "little application"), it must be embedded \
into the web page as an Object with the necessary parameters or
variables passed to it. The Java Applet will then execute
independently of the Browser as a separate program.

JavaScript is an integral part of the Browser. It can be added in
either the HEAD or BODY of a web page. Where you place it
depends on where it will be most appropriate. In fact, you can
add as many separate JavaScripts as you like. Since JavaScript is
executed by the Browser, its functions and variables are global; a
concept that will give many Object Oriented programmers the
shivers. That means that a variable or function in one JavaScript
can be used in another and can access the underlying HTML
DOM (Document Object Model) directly.

If that sounds complex, in fact it is not. It is probably more
intuitive for most novice users, which is exactly the intent. But if
you have little or no programming experience and really don't
want any, then you are in luck. There are many existing
JavaScripts available that can be easily copied and pasted into
your web pages. All you need is a little understanding of how to
do it.

JavaScript is added to a web page with the Script tags. The
correct format is: