prompt method (window)
Displays a prompt dialog with a message, an input field, an OK and a Cancel button.
Script execution does not continue until the prompt method returns (the user presses the OK or the Cancel button or closes the prompt dialog).
You can find the related objects in the Supported by objects section below.
|Optional. String that specifies the text for the message in the dialog box. Default is an empty string.|
|Optional. String that specifies the default value of the input field. If not specified, the input field will be empty in Firefox, Opera, Google Chrome and Safari, and will contain 'undefined' in Internet Explorer.|
If the prompt dialog was closed by the Cancel button or by the system Close button, the prompt method returns null in Internet Explorer, Firefox, Google Chrome and Safari, and returns undefined in Opera. Otherwise, the prompt method returns a string that represents the value of the input field at that time when the prompt dialog was closed.
Example HTML code 1:
This example illustrates the use of the prompt method:
Did you find this example helpful?
Supported by objects:
User Contributed Comments