34,333
edits
Changes
→Displaying Message Box Dialogs
== Displaying Message Box Dialogs ==
The JavaScript window object provides methods to display three types of message dialogs, the alert, confirmation and prompt dialogs:
* '''alert''' - intended to display a message to the user. It contains a message area where the alert message is to be displayed and an "OK" button that the user can click to dismiss the dialog. The ''alert()'' method takes a single argument representing the message to be displayed in the dialog. The following web page fragment displays an alert dialog with the message "You do not have a valid password" when the "Show Alert" button is clicked:
<pre>
<form action="null">
<input type="button" value="Show Alert" onclick="window.alert('You do not have a valid password')" />
</form>