See also: confirm, prompt

Displays an alert dialog box with a message and an OK button. Use the alert method to display a message that does not require a user decision.

Syntax

JSV_alert(title, msg, icon, modality)

Prototype

n/a

Returns

The alert method returns true if the user chooses Yes or OK, and false if the user chooses No or Cancel.

Parameters

The alert function uses the following arguments.

Argument Description
title A string to be displayed in the dialog title bar
msg A string to be displayed as the message to the user
icon An integer value between 0 and 4, inclusive, that denotes the icon to be displayed in the alert dialog box. Default value is 3.
modality An integer, either 0 or 1, denoting the modality of the dialog. Default value is 0. (refer to the Message Box table)

Remarks

Message Box
Argument Value Display
icon 0 No icon displayed
1
2
3
4
modality 0 Application Modal. Present application (browser) is suspended until user responds.
1 System Modal. All applications (windows) are suspended until user responds.

Dependencies

n/a

Example

The following lines of code

function testAlert() {
    JSV_alert("JavaScript Vision Alert", "This is the new alert.", 4);
}

produce

Test Alert Dialog