next up previous
Next: The Status Bar Up: JavaScript Examples Previous: Opening a New Window

Messages and Confirmations

JavaScript provides three built-in window types:

prompt("string, string ")
: displays a simple window that contains a prompt and a textfield in which the user can enter data.

E.g. prompt("You are being prompted", "");


Figure: JavaScript prompt

prompt cont.
: The method a has two parameters:

confirm("string ")
: Shows a window containing a message and two buttons: OK and Cancel.

E.g. confirm("Please Confirm?");


Figure: JavaScript confirm

confirm cont.
:

Sample applications:

alert("string ")
: Displays the text string and an OK button.

E.g. alert("Are You Alert?");


Figure: JavaScript alert



Dave Marshall
9/28/2001