Label

This element is used to provide a label for an control element, If the user clicks the label, it will move the focus to the associated control, specified with the control attribute.

More information about label

The label element implements the following interfaces:

nsIAccessibleProvider   nsIDOMXULLabelElement  

Attributes:

accesskey control crop disabled value

Style Classes:

header indent monospace plain small-margin
text-link

Properties and Methods:

accessKey accessible control crop disabled
value

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

accesskey

Type: character

This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the label. This letter will typically be drawn underlined, although this behavior will be platform and theme specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the label will be activated from anywhere in the window. Although the value is case insensitive, a letter with the case matching the accesskey attribute will used if both cases exist in the label.

control

Type: element id

This attribute should be set to the id of an element that the label is associated with. When the user clicks on the label, the associated element is given the focus.

crop

Type: one of the values below

If the label of the label is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed.

disabled

Type: boolean

If this attribute is set to true, the label is disabled. This is usually drawn with the text in grey. Leave the attribute out entirely for a regular enabled label.

value

Type: string

The text to be used for the label.


Style Classes:

The following classes may be used to style the element. These classes should be used instead of changing the style of the element directly since they will fit more naturally with the user's selected theme.

header

A class used for headings. Typically, this will cause the text to appear bold.

indent

This class causes the text to be indented on its left side.

monospace

This class causes the text to be displayed in a monospace font.

plain

This class causes the text to be displayed with no border or margin.

small-margin

This class causes the text to be displayed with a smaller margin.

text-link

Labels with this class may be focused and the click handler run on a mouse click or enter key press.


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

accessKey

Type: character

Gets and sets the value of the accesskey attribute.

accessible

Type: nsIAccessible

Returns the accessibility object for the label.

control

Type: element id

Gets and sets the value of the control attribute.

crop

Type: string

Gets and sets the value of the crop attribute.

disabled

Type: boolean

Gets and sets the value of the disabled attribute.

value

Type: string

Gets and sets the value of the value attribute.


Copyright (C) 1999 - 2004 XulPlanet.com