Java Reference
In-Depth Information
window.alert("Hello")
The window.confirm() method will stop the execution of the program and display a
confirmation dialog that shows the message provided as an argument and giving the op-
tions of OK or Cancel. It returns the Boolean values of true if the user clicks OK and
false if the user clicks Cancel:
window.confirm("Do you wish to continue?")
The window.prompt() method will stop the execution of the program. It displays a
dialog that shows a message provided as an argument as well as an input field that allows
the user to enter text. This text is then returned as a string when the user clicks OK. If the
user clicks Cancel, null is returned:
window.prompt("Please enter your name?")
Warning: Dialogs Stop Processing
It is worth reiterating again that these methods will stop the execution of
a program in its tracks. This means that everything will stop processing at
the point the method is called, until the user clicks OK or Cancel. This can
cause problems if the program needs to process something else at the same
time or the program is waiting for a callback to be called.
Search WWH ::




Custom Search