Home > Element Reference : Tabs

Contents

### Tabs

A row of tabs. A tabs element should be placed inside a tabbox and should contain tab elements.

More information about tabs

The tabs element implements the following interfaces:

nsIAccessibleProvider nsIDOMXULSelectControlElement

Attributes:

closebutton | disableclose | first-tab | last-tab | onclosetab
onnewtab | onselect | setfocus | tooltiptextnew

Properties and Methods:

advanceSelectedTab | appendItem | insertItemAt | removeItemAt | selectedIndex
selectedItem

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

##### closebutton

Type: boolean

If this attribute is set to true, the tabs row will have a new tab button and close button on the ends. This feature is used by the tabbrowser to add the capability to add new tabs and close existing tabs. You can set an image to the new and close buttons by applying them to the 'tabs-newbutton' and 'tabs-closebutton' classes respectively.

##### disableclose

Type: boolean

If tis attribute is true, the close button will be disabled.

##### first-tab

Type: boolean

This attribute will be set to true for the first tab. This attribute should not be set manually, but is useful in a theme if the first tab should be styled differently.

##### last-tab

Type: boolean

This attribute will be set to true for the last tab. This attribute should not be set manually, but is useful in a theme if the last tab should be styled differently.

##### onclosetab

Type: script code

This script will be called when the close tab button is clicked.

##### onnewtab Not in Firefox

Type: script code

This script will be called when the new tab button is clicked.

##### onselect

Type: script code

This event is sent to the tabs element when the tab is changed.

##### setfocus

Type: boolean

If true or omitted, the focus will be given to the first element in the corresponding tabpanel when the tabs are navigated via the keyboard. If this attribute is false, the focus does not change during navigation.

##### tooltiptextnew Not in Firefox

Type: string

Used to set the text which appears in the tooltip when the user moves the mouse over the new button in the tab row.

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

##### advanceSelectedTab ( dir , wrap )

Return Type: no return value

If the argument dir is set to 1, the currently selected tab changes to the next tab. If the argument dir is set to -1, the currently selected tab changes to the previous tab. If the wrap argument is true, the adjustment will wrap around when the first or last tab is reached.

##### appendItem ( label , value )

Creates a new tab element and adds it to the end of the list of tabs. You may optionally set a value. Note that a new tabpanel is not created. This method returns the added tab. The function returns the new item.

##### insertItemAt ( index, label , value )

Return Type: tab element

Creates a new tab element and inserts it at a specific position in the list of tabs. You may optionally set a value. This method returns the added tab. The function returns the new item.

##### removeItemAt ( index )

Return Type: tab element

Removes the child tab in the menu at the given index. The function returns the removed item.

##### selectedIndex

Gets and sets the value of the selectedindex attribute.

##### selectedItem

Type: tab element

Holds a reference to the currently selected tab element. Assign a value to this property to modify the currently selected tab.

Copyright (C) 1999 - 2004 XulPlanet.com