November 12, 1999 - Alert Dialog Boxes
November 12, 1999 Alert Dialog Boxes Tips: November 1999
Yehuda Shiran, Ph.D.
|
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.