whats the html code to make a password pop up and if you get it right it goes to the page?

Archived in the category: html pop up
Posted by Kristen Meyers on 26 Feb 09 -

im making a sight and i need the code but i cant find it

Here is the code:

To install this code, paste all of it starting from the <!–
Then open a notepad window and paste all the code in. Save the document as an HTML page by giving it the file extension .htm when you name it. For example, you may name it something like "password.htm". Just make sure you have the .htm at the end.

You may notice that this is not HTML, but is in fact, Java. HTML cannot do functions like password protection and other active browser functions. The default settings for the destination pages are set to the Yahoo home page. The notes in the script show where to change this to any website you want.

The password is: password (change to whatever you want in the script)

Have fun with the script.

<!– ONE STEP TO INSTALL PASSWORD PROTECT:

1. Copy the coding into the HEAD of your HTML document –>

<!– STEP ONE: Paste this code into the HEAD of your HTML document –>

<HEAD>

<script type="text/javascript">
<!– Begin

var password;
var pass1 = "password"; // place password here

password=prompt("Please enter your password:","");

if (password==pass1) {
window.location= "http://yahoo.com"; // file to open if password is correct
} else {
window.location= "http://yahoo.com"; // file to load if password is incorrect
}
// End –>
</script>
<!– Script Size: 0.81 KB –>

powered by Yahoo Answers

4 comments for “whats the html code to make a password pop up and if you get it right it goes to the page?”

1
Trev

It not HTML.
It's a password protected directory.

For a Unix based system it's done like this:

You put a file with an encrypted password on the server.
And a file called .htaccess in the directory

The .htaccess kicks in when someone tries to access folder, this points to where the password file is on the server.

You enter details in box.
The password is encrypted and compared to the username password.
If the two match, you are in.

Google for
password protected directory
OR
.htaccess
References :

February 26th, 2009 at 11:04 am
2
byteofk

You're making a "site". It's a location, not vision.

There's no pure HTML way of doing it. If your site runs Apache as its web server you can either:

1) Set up a password for a specific folder or the whole site by editing a .htaccess file - one of many places to research it here:
http://www.elated.com/articles/password-protecting-your-pages-with-htaccess/

2) Javascript:
http://javascript.internet.com/passwords/

Anything deeper needs some coding knowledge like PHP or ASP.
References :

February 26th, 2009 at 11:52 am
3
mawduce65

Here is the code:

To install this code, paste all of it starting from the <!–
Then open a notepad window and paste all the code in. Save the document as an HTML page by giving it the file extension .htm when you name it. For example, you may name it something like "password.htm". Just make sure you have the .htm at the end.

You may notice that this is not HTML, but is in fact, Java. HTML cannot do functions like password protection and other active browser functions. The default settings for the destination pages are set to the Yahoo home page. The notes in the script show where to change this to any website you want.

The password is: password (change to whatever you want in the script)

Have fun with the script.

<!– ONE STEP TO INSTALL PASSWORD PROTECT:

1. Copy the coding into the HEAD of your HTML document –>

<!– STEP ONE: Paste this code into the HEAD of your HTML document –>

<HEAD>

<script type="text/javascript">
<!– Begin

var password;
var pass1 = "password"; // place password here

password=prompt("Please enter your password:","");

if (password==pass1) {
window.location= "http://yahoo.com"; // file to open if password is correct
} else {
window.location= "http://yahoo.com"; // file to load if password is incorrect
}
// End –>
</script>
<!– Script Size: 0.81 KB –>
References :

February 26th, 2009 at 12:06 pm
4
Colinc

You will need a database for user and security information, then use php to control and read the data. Your php code can then build dynamic pages, or just call other pages to view.
References :

February 26th, 2009 at 12:49 pm

Laeave a Reply