It's window.prompt("message", "default"), where message is the text on the box, default is the default text in the user input area. It returns the string the user typed, an empty string if they didn't type anything, and null if they clicked cancel.
Printable View
It's window.prompt("message", "default"), where message is the text on the box, default is the default text in the user input area. It returns the string the user typed, an empty string if they didn't type anything, and null if they clicked cancel.
Hi Josh,
Thanks for this!! How can I now store whatever the user entered in a variable so that I can use it again later eg. after the user enters whatever into the textbox I want to now do something like alert(var1) - where var1 is what the user entered.
Also, how can I change the input box NOT to have the OK,CANCEL and the text "Explorer user prompt" and "Javascript Prompt" on it. Can I also determine the size of the box as well as where it's positioned on the screen.
Thanks,
T
I don't think you can change much to the prompt. Some of the text is put there for security reasons (actually, so you can't trick ignorant users).Code:var1 = prompt("blah blah", "NO!");
alert(var1);