DHTML Methods
Displays a Prompt dialog box with a message and an input field.
vTextData = window.prompt ( [ sMessage ]
[ , sDefaultValue ] )
sMessage |
Optional. String specifying the message to display in the dialog box. By default, this parameter is set to "". |
sDefaultValue |
Optional. String specifying the default value of the input field. By default, this parameter is set to "undefined". |
String or Integer. Returns the value typed in by the user.
The title of the prompt dialog box cannot be changed.
The following script will display a simple Prompt dialog box and store the user's input to a variable named what, which can then be used to trigger another function.
<script language="JavaScript">
function promptSearch ( ) {
what = prompt ( "What will you search for?",
"Type text to search here" );
doSearch ( what );
}
</script>
Show me
window
alert, confirm