November 12, 1999 - Alert Dialog Boxes | WebReference

November 12, 1999 - Alert Dialog Boxes

Yehuda Shiran November 12, 1999
Alert Dialog Boxes
Tips: November 1999

Yehuda Shiran, Ph.D.
Doc JavaScript

An alert dialog box is a window that presents a message to the user with a single OK button to dismiss the dialog box. As long as the alert dialog box is showing, no other application or window can be made active. The alert() method accepts a string specifying the message to display:

alert("Click OK to continue...");
var message = "Click OK to continue...";
alert(message);

In fact, the single parameter to the alert() method can be a value of any data type, including representations of some ususual data types whose values you don't normally work with in JavaScript. This makes the alert dialog box a handy tool for debugging scripts. Any time you want to monitor the value of an expression, use the expression as the argument to an alert() method in your script.

Alert dialog boxes are often very annoying, because they disrupt the flow of a user's navigation around your pages. It is better to communicate with users via forms or by writing to seperate windows.