Web Teacher Software
web database
Javacript 
Tutorial
CGI tutorial
web 
database consulting
web database training
contact us about web 
database software
press
Hosted Database Solutions
webteacher home
Web Teacher Consulting

javascript tutorial graphic


Webteacher Software now offers

function password() {
Ret = prompt('Type the word castle',"");
if(Ret=="castle") {
location = 'ch03_1.html';

The prompt

The first line of the function, password() is:

Ret = prompt('Type the word castle',"");

This command tells the computer to open a prompt box, and assign whatever the user types to the variable, Ret. Therefore if the user types "chickensoup", the computer will execute the command
Ret="chickensoup"

I can then compare the variable Ret with other text to determine if the user typed in the correct password.

The parentheses contain the message inside the prompt box, then the default text. Look at this sample command, then click the show me button

prompt("Please type your name","Newt")

If you do not want a default, simply place 2 quotes after the comma like I did in the original example.

This is Easy

Home | WebData - Web Database Software | Javascript | CGI | Consulting | Map Builder | Contact Us | The Press Room