window.alert()

JavaScript1.0+, JScript1.0 Nav2+, IE3+, Opera3+ Syntax

							window.alert(string)

Description

The alert() method of the Window object displays an alert dialog box when invoked. The value of the string passed to the method is displayed in the box.

Example

Listing 7.525 pops up an alert box when the script is loaded. The result of running this script can be seen in Figure 7.16.

Figure 7.16. An alert box created with the Window.alert() method.

Listing 7.525 An Alert Box
<script language="JavaScript">
<!-- Hide
alert('Here is an alert dialog box.');

// End hide --->
</script>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.