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 : null

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:

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 default answer appear.

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:

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.

Table of Contents