Name

prompt( ) — NN 2 IE 3 DOM n/a

Synopsis

prompt(message, defaultReply)

Displays a dialog box with a message, a one-line text entry field, and two clickable buttons. The message should urge the user to enter a specific kind of answer. One button indicates a Cancel operation; the other button indicates the user’s approval of the text entered into the field (OK or Yes). The text of the buttons is not scriptable. A click of the Cancel button returns a value of null; a click of the OK button returns a string of whatever is in the text entry field at the time (including the possibility of an empty string). It is up to your scripts to test for the type of response (if any) supplied by the user.

Returned Value

When clicking the OK button, a string of the text entry field; when clicking Cancel, null.

Parameters

message

Any string.

defaultReply

Any string that suggests an answer. Always supply a value, even if an empty string.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.