eHow launches Android app: Get the best of eHow on the go.
Summary: In order to password-protect a Web page, use javascript and start by opening up passpage.htm. Protect a Web site with passwords by running code with tips from a software developer in this free video on using the Internet.
Dave Andrews is a software developer with a business and Web site selling programs and other computer services in Franklin, Tenn. Having worked in the IT industry for more than 8...read more
"Hi, my name's Dave Andrews. Today I'm going to show you how to password-protect a web page. We're going to do this using javascript. So, if we go to the computer, let's open up passpage dot htm. You can see I got three pages here. There's passpage, pagetwo, and incorrect. The one that we are protecting is pagetwo. So, let's open up passpage, which is the page that's going to ask for a password. Now, I should note that javascript is not the most secure way to do this because anybody can look at the source of your web page and figure out your password. But what I've done, is I put a script inside the header of this document that says it's a function called regulate and it says if the pass dot value, pass is a input field that I have down here named pass and it's type is password. It says if pass dot value is equal to Dave, then redirect the window to page two, which is the page we're protecting, otherwise redirect the window to incorrect. Down here is my form. I'll separate that a little bit. You see I've named my form pass, which is this part right here, if document dot pass, and then I have a password type that's also called pass. That is the second dot pass. That's referring to the input in getting the value out of it. I've got that, as well as a button that just says "access to site". The onClick value for that button calls the javascript regulate function. So, when they click that button, it's going to run this code up here at the top. Let's see this in action. I'm not going to save my changes. Let's go to open that web page. Now, because I'm running this off of my web browser, Internet Explorer is saying that it's insecure because it's running javascript that accesses other pages on my local computer. So I'm just going to allow that blocked content. The first thing I'm going to do is type in an incorrect password. I just typed incorrect and say access site. As you can see, I've been redirected to incorrect.htm. I'm going to type the correct password, which is Dave and just say access site. Now as I was mentioning about security, anybody can right-click inside your desktop, or the web page and say view source and they could figure out your password just by looking at that. So, this is not the best idea, but it's a good quick way to protect a web file, web site."
eHow Article: How to Password-Protect a Web Page