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.
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.
The only difference between the function with the prompt and this is the line
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.
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>
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;}
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.
||glossary||library||Links||Labratory||Awards||