JavaScript Method




The title HTML text to display on the message box.


The HTML to display in the body of the message box.


A flag to tell the message box what buttons to display. The values for this flag are:


"OK" button.


"OK" and "Cancel" buttons.


"Yes" and "No" buttons.


"Yes", "No" and "Cancel" buttons.


No buttons.


A Javascript function that will be called when the user closes the message box. This function will be passed a string containing the value of the button the user pressed ("ok", "yes", "no", or "cancel").


Displays a message box.


This function can be used to display a message box in the HTML that is done entirely in JavaScript and HTML meaning that you can present the user with a customized HTML message.


This example shows how to create a message box with an Yes, No, and Cancel button. This message is shown when the user attempts to close a window before saving their work. The onClose function will handle saving or closing without saving when the user clicks a button. In this example, if the user clicks the "yes" button, a Javascript Action will be run to save their work and close the window. If the user clicks "no", a Javascript Action is run to close the window without saving. If the user clicks "cancel" or closes the window without making a choice, the action is cancelled.

var title = 'Save Before Closing?';
var html = '<p>Do you wish to save your work before closing the window?</p>';
var type = 'ync';
var onClose = function (btn) {
    if (btn == 'yes') {
        // save their work then close the window
    } else if (btn == 'no') {
        // close the window
    } else {
        // cancel - do nothing
};, html, type, onClose);

Example: Customizing HTML Buttons

You can set properties to control the text and class of the OK and Cancel buttons. Example:

A5.msgBox.buttons.ok = {html: 'My OK HTML', className: 'MyOKButtonClassName'};
A5.msgBox.buttons.cancel = {html: 'My Cancel HTML', className: 'MyCancelButtonClassName'};
A5.msgBox.buttons.ok = {html: 'My OK HTML', className: 'MyOKButtonClassName'};
A5.msgBox.buttons.cancel = {html: 'My Cancel HTML', className: 'MyCancelButtonClassName'};

See Also