HTML DOM prompt() Method
Complete Window Object Reference
Definition and Usage
The prompt() method is used to display a dialog box that prompts the user for
input.
Syntax
Parameter |
Description |
text |
Optional. The message to display in the dialog box. Default
is "" |
defaultText |
Optional. The default input text |
Example
The following example displays a prompt box:
<html>
<head>
<script type="text/javascript">
function disp_prompt()
{
var name=prompt("Please enter your name","")
if (name!=null && name!="")
{
document.write("Hello " + name + "!")
}
}
</script>
</head>
<body>
<input type="button" onclick="disp_prompt()"
value="Display a prompt box" />
</body>
</html>
|
Try-It-Yourself Demos
Display a prompt box
Complete Window Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|