Prompt
Question: How do I generate a user prompt from JavaScript?
Answer: To generate a user prompt, use the prompt()
method:
prompt('Prompt text','Suggested input')
The button above was created using the following code:
<form name=myform>
<input type=button value="Try it now"
onClick="f=prompt('Enter your name','Name');
alert('Hello '+f+'!')">
</form>
JavaScripter.net.
Copyright
© 1999-2006, Alexei Kourbatov