Home > Element Reference : Dialog

Contents

### Dialog

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 about dialog

Attributes:

| buttonaccesskeyaccept | buttonaccesskeycancel | buttonaccesskeydisclosure | buttonaccesskeyextra1
buttonaccesskeyextra2 | buttonaccesskeyhelp | buttonalign | buttondir | buttonlabelaccept
buttonlabelcancel | buttonlabeldisclosure | buttonlabelextra1 | buttonlabelextra2 | buttonlabelhelp
buttonorient | buttonpack | buttons | defaultButton | ondialogaccept
ondialogcancel | ondialogdisclosure | ondialoghelp | title

Properties and Methods:

acceptDialog | buttons | cancelDialog | centerWindowOnScreen | defaultButton
getButton | moveToAlertPosition

#### Attributes:

Inherited from XUL Element:

align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
preference-editable
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width

##### buttonaccesskeyaccept

Type: string

The access key to use for the accept button.

##### buttonaccesskeycancel

Type: string

The access key to use for the cancel button.

##### buttonaccesskeydisclosure

Type: string

The access key to use for the disclosure button.

##### buttonaccesskeyextra1

Type: string

The access key to use for the first extra button.

##### buttonaccesskeyextra2

Type: string

The access key to use for the second extra button.

##### buttonaccesskeyhelp

Type: string

The access key to use for the help button.

##### buttonalign

Type: string

The value of the 'align' attribute for the box containing the buttons.

##### buttondir

Type: string

The value of the 'dir' attribute for the box containing the buttons.

##### buttonlabelaccept

Type: string

The label to appear on the accept button.

##### buttonlabelcancel

Type: string

The label to appear on the cancel button.

##### buttonlabeldisclosure

Type: string

The label to appear on the disclosure button.

##### buttonlabelextra1

Type: string

The label to appear on the first extra button.

##### buttonlabelextra2

Type: string

The label to appear on the second extra button.

##### buttonlabelhelp

Type: string

The label to appear on the help button.

##### buttonorient

Type: string

The value of the 'orient' attribute for the box containing the buttons.

##### buttonpack

Type: string

The value of the 'pack' attribute for the box containing the buttons.

##### buttons

Type: comma-separated list of the values below

A comma-separated list of buttons to appear on the dialog box. The buttons will be placed in suitable locations for the user's platform and basic event handling will be performed automatically. The following values can be used in the list:

- accept: The OK button, which will accept the changes when pressed. This button will also be the default button.
- cancel: The cancel button which will cancel the operation.
- help: A help button for displaying help about the dialog.
- disclosure: A button to show more information. This might be a button or a disclosure triangle.
- extra1: An optional additional button. You can set its label with the buttonlabelextra1 attribute.
- extra2: A second optional additional button. You can set its label with the buttonlabelextra2 attribute.

##### 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.

##### ondialogaccept

Type: script code

The code in this attribute is called when the OK button is pressed, or when the acceptDialog function is called.

##### ondialogcancel

Type: script code

The code in this attribute is called when the Cancel button is pressed, or when the cancelDialog function is called.

##### ondialogdisclosure

Type: script code

The code in this attribute is called when the disclosure button is pressed.

##### ondialoghelp

Type: script code

The code in this attribute is called when the Help button is pressed.

##### title

Type: string

The text to appear on the title bar of the dialog box.

#### Properties and Methods:

Inherited from XUL Element:

align
allowEvents
blur
boxObject
boxObject.element
boxObject.getLookAndFeelMetric
boxObject.height
boxObject.screenX
boxObject.screenY
boxObject.width
boxObject.x
boxObject.y
builder
className
click
collapsed
contextMenu
controllers
database
datasources
dir
doCommand
flex
focus
getElementsByAttribute
height
hidden
id
left
maxHeight
maxWidth
menu
minHeight
minWidth
observes
ordinal
orient
pack
persist
ref
resource
statusText
style
tooltip
tooltipText
top
width

Inherited from Element:

addEventListener
appendChild
attributes
childNodes
cloneNode
dispatchEvent
firstChild
getAttribute
getAttributeNS
getAttributeNode
getAttributeNodeNS
getElementsByTagName
getElementsByTagNameNS
hasAttribute
hasAttributeNS
hasAttributes
hasChildNodes
insertBefore
isSupported
lastChild
localName
namespaceURI
nextSibling
nodeName
nodeType
nodeValue
normalize
ownerDocument
parentNode
prefix
previousSibling
removeAttribute
removeAttributeNS
removeAttributeNode
removeChild
removeEventListener
replaceChild
setAttribute
setAttributeNS
setAttributeNode
setAttributeNodeNS
tagName

##### acceptDialog ( )

Return Type: no return value

Accepts the dialog and closes it, similar to pressing the OK button.

##### buttons

Type: comma-separated list of the values below

A comma-separated list of buttons to appear on the dialog box. The buttons will be placed in suitable locations for the user's platform and basic event handling will be performed automatically. The following values can be used in the list:

- accept: The OK button, which will accept the changes when pressed. This button will also be the default button.
- cancel: The cancel button which will cancel the operation.
- help: A help button for displaying help about the dialog.
- disclosure: A button to show more information. This might be a button or a disclosure triangle.
- extra1: An optional additional button. You can set its label with the buttonlabelextra1 attribute.
- extra2: A second optional additional button. You can set its label with the buttonlabelextra2 attribute.

##### cancelDialog ( )

Return Type: no return value

Cancels the dialog and closes it, similar to pressing the Cancel button.

##### centerWindowOnScreen

Type: no return value

Centers the dialog on the screen.

##### 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.

##### getButton ( type )

Return Type: button element

Returns the button element in the dialog corresponding to the given type.

##### moveToAlertPosition

Type: no return value

Moves and resizes the dialog to a position and size suitable for an alert box.

Copyright (C) 1999 - 2004 XulPlanet.com