This element should be used in place of the window
element for dialog boxes. The buttons
attribute may be used to set which buttons should appear in the dialog box. These buttons will be placed in the correct locations for the user's platform.
More information is available in the XUL tutorial and Dialogs and prompts (code snippets).
- Attributes
- buttonaccesskeyaccept, buttonaccesskeycancel, buttonaccesskeydisclosure, buttonaccesskeyextra1, buttonaccesskeyextra2, buttonaccesskeyhelp, buttonalign, buttondir, buttondisabledaccept, buttonlabelaccept, buttonlabelcancel, buttonlabeldisclosure, buttonlabelextra1, buttonlabelextra2, buttonlabelhelp, buttonorient, buttonpack, buttons, defaultButton, title
- Properties
- buttons, defaultButton
Examples
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog id="donothing" title="Dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" buttons="accept,cancel" buttonlabelcancel="Cancel" buttonlabelaccept="Save"> <dialogheader title="Options" description="My preferences"/> <groupbox> <caption label="Colour"/> <radiogroup> <radio label="Red"/> <radio label="Green" selected="true"/> <radio label="Blue"/> </radiogroup> <label value="Nickname"/> <textbox/> </groupbox> </dialog>
Attributes
activetitlebarcolor
- Type: color string
- Specify background color of the window's titlebar when it is active (foreground). Moreover this hides separator between titlebar and window contents. This only affects Mac OS X.
defaultButton
- Type: string
- Normally this attribute should not be set, but if it is, it specifies the default button in the dialog. Typically, this means that the button will be activated when the Enter key is pressed. This should be set to one of the same values as those for the
buttons
attribute.
inactivetitlebarcolor
- Type: color string
- Specify background color of the window's titlebar when it is inactive (background). Moreover this hides separator between titlebar and window contents. This affects only on Mac OS X.
title
- Type: string
- The text to appear in the title bar of the window.
Properties
defaultButton
- Type: string
- Normally this attribute should not be set, but if it is, it specifies the default button in the dialog. Typically, this means that the button will be activated when the Enter key is pressed. This should be set to one of the same values as those for the
buttons
attribute.
Methods
acceptDialog()
- Return type: no return value
- Accepts the dialog and closes it, similar to pressing the OK button.
cancelDialog()
- Return type: no return value
- Cancels the dialog and closes it, similar to pressing the Cancel button.
centerWindowOnScreen()
- Return type: no return value
- Centers the dialog on the screen.
getButton( type )
- Return type: button element
- Returns the
button
element in the dialog corresponding to the given type.
moveToAlertPosition()
- Return type: no return value
- Moves and resizes the dialog to a position and size suitable for an alert box.
Related
- Elements
dialogheader