shadowline
Confirm << Prompt >> Status Bar
A PROMPT is used to actually gather a bit of information when a simple TRUE/FALSE is not enough. This will take some information from the visitor and you can use it in other applications.

In the PROMPT example, you entered :

Did you notice I was able to use the input answer in both the ALERT box and for an actual answer above?

Here is the example coding :

<script type="text/javascript">
<!--

var answer = prompt ("What is your name ?","")
alert ("Hello there, " + answer)

// -->
</script>

VAR means VARIABLE. A temporary storage place.

ANSWER is the name of that storage place. The visitor's input is stored in this space.

PROMPT creates the actual pop-up box with a text area for the visitor to enter information based on the text following the PROMPT command. The empty set of quotes in the second part of the PROMPT is to clear the PROMTP text box. You can enter any text within the quotes to have a defualt answer appear.

<script type="text/javascript">
<!--

var answer = prompt ("What is your name ?","")
alert ("Hello there, " + answer)

// -->
</script>

ALERT will put up an ALERT box containing the following text.

+ ANSWER adds the input entry to the end of the ALERT text.



To make the answer appear on the page itself, I used this code :

In the PROMPT example, you entered :

<script type="text/javascript">
<!--

document.write ( answer )

// -->
</script>

DOCUMENT.WRITE tells the browser to WRITE this on the current DOCUMENT. The document refers to the web page.

ANSWER still holds the value entered by the visitor.
Confirm << Prompt >> Status Bar
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow