Make your own free website on Tripod.com

JavaScript Password

.
Try clicking that and entering topsecret as your password. Then return here and I'll show the script.

Waiting.......

<script language="JavaScript">
<!-- Hide
var word=""; function pass(){
var word = promp("Enter your password","");
word=(word+.html)
location = word;}
// End Hide -->
</script>

This is the safest password script. The password is what ever the last part of your page address is. The full address of the page that you get to from the function above is.
members.tripod.com/~grizzlyA/help/topsecret.html
Since your location is already in your system up to the point of /help/ all you need for location is the topsecret.html

There's a new JavaScript word here. location. This word will come into use on the next page. Building a So the prompt asks you for a password and then adds .html to the end of it and then heads for that page. You could create a page with a strange address like d8hftal.html and then give the people you want to have access the first part of the address as the password d8hftal If you wanted to take the password from someone you would have to change the address of your page and give out the new password.

.
Another way of doing the same thing.

Okay this uses a different type of form and variable use. First I'll show the form.
<form name="the_form">
<input name="the_input">
<input type="button" value="Enter" onClick=pass2()>
</form>

In this form I have named it. The purpose of naming it is so the function to be called when Enter is hit can retrieve the info and use it. It also uses the name of the input box. In this case it is the_input. You can name your form pretty much anything, make it something you can remember. If you have multiple forms or input areas you want to be able to easily recall them when doing your function writing.
Now for the function. I have two functions in this page but I'll show an example of a page that only has the one for this form.
<html>
<head>
<title>My homepage</title>
<script language="JavaScript"> <!--Hide
var word=""; function pass2(){
word=document.the_form.the_input.value;
word=word+".html";
location=word;}

The only difference between the function with the prompt and this is the line
word=document.the_form.the_input.value;
Instead of having a prompt to get the value for word it is read from the_input box then the .html is added to that and location is used to go to that address.
If you had your page at a different place than the page with the password prompt or text box you would need to alter word so it would link right.

such as
word="http://members.theglobe.com/whatever/"+word+".html"



I am working on some that actually have an encoded password and address within the script so if that is what you are looking for check back soon.


|| index||page 1||page 2||page 3||page 4||page 5||page 6||page 7||Page 8||
||glossary||library||Links||Labratory||Awards||