Navigator 2.0, Internet Explorer 3.0
window.prompt(message) window.prompt(message, default)
The plain text (not HTML) string to be displayed in the dialog. It should ask the user to enter the information you want. On Windows platforms, only one line messages are allowed.
An optionally specified string or integer which will be displayed as the default input in the dialog. If null is specified, or if this argument is not passed at all, then prompt() displays the string "<undefined>" as the default value. Pass the empty string ("") to make prompt() display an empty input box.
The string entered by the user, or the empty string if the user did not enter a string, or null if the user clicked Cancel.
The prompt() method displays the specified message in a dialog box that also contains a textual input field and OK, Clear, and Cancel buttons. Platform-dependent graphics in the dialog help to indicate to the user that her input is desired.
The default argument specifies the text that initially appears in the input field. If default is null, or if this optional argument is not passed at all, then the initial text is "<undefined>". If default is the empty string ("") then the input field is initially empty. Otherwise, the input field displays the string or number that is passed as the default.
If the user clicks the Cancel button, prompt() returns null. If the user clicks the Clear button, prompt() erases any current text in the input field. If the user clicks the OK button, prompt() returns the value current value displayed in the input field. Note, however, that if the input field is displaying "<undefined>" because the default argument was null or unspecified, then prompt() returns the empty string and not the string "<undefined>". Also note that prompt() always returns the user's input as a string value, even if default was specified as a numeric value. If necessary, you can use parseInt() or parseFloat() to convert the returned string to a number.
The dialog box that is displayed by the prompt() method is modal--that is, it blocks all user input to the main browser window until the user dismisses the dialog by clicking on the OK or Cancel buttons. Since this method returns a value depending on the user's response to the dialog, JavaScript execution pauses in the call to prompt(), and subsequent statements are not executed until the user responds to the dialog.
Note that the question displayed in the dialog is a string of plain text, not of formatted HTML. Unlike the message displayed by the alert() and confirm() methods, the message displayed by prompt() may only be a single line long on Windows platforms.
file: /Techref/language/java/script/definitive/refp_457.htm, 7KB, , updated: 2019/10/14 15:00, local time: 2024/11/15 22:49,
18.191.26.4:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.ecomorder.com/techref/language/java/script/definitive/refp_457.htm"> [Chapter 21] Reference: Window.prompt()</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.