Visit Mozilla.org

DOM:window.confirm

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

Displays a modal dialog with a message and two buttons, OK and Cancel.

[edit] Syntax

result = window.confirm(message);
  • message is the string to be displayed in the dialog.
  • result is a boolean value indicating whether OK or Cancel was selected (true means OK).

[edit] Example

if (window.confirm("Want to see my mood ring?")) { 
    window.open("mood.html", "mood ring", "");
}

[edit] Notes

Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function that creates a dialog box (or modal window).

Chrome users (e.g. extensions) should use methods of nsIPromptService instead.

[edit] Specification

DOM Level 0. Not part of any standard.

[edit] See also

alert, prompt