Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Nos bénévoles n'ont pas encore traduit cet article en Français. Aidez-nous à réaliser cette tâche !

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

NB: You can add some other elements to tabs such as button, but they will receive an index. Activating them will not change the selectedIndex.

More information is available in the XUL tutorial.

Attributes
closebutton, disableclose, disabled, onclosetab, onnewtab, onselect, setfocus, selectedIndex, tabbox, tabindex, tooltiptextnew, value,
Properties
accessibleType, disabled, itemCount, selectedIndex, selectedItem, tabIndex, value,
Methods
advanceSelectedTab, appendItem, getIndexOfItem, getItemAtIndex, insertItemAt, removeItemAt

Examples

(example needed)

Attributes

closebutton Obsolete since Gecko 1.9.2
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 provide the facilities for adding and closing tabs. You can set an image to the "new tab" and "close" buttons by applying them to the tabs-newbutton and tabs-closebutton classes respectively.
disableclose
Type: boolean
If this attribute is true the close button will be disabled.
disabled
Type: boolean
Indicates whether the element is disabled or not. If this element is set to true the element is disabled. Disabled elements are usually drawn with grayed-out text. If the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire.
Visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state.
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 this tab is changed.
selectedIndex
Type: integer
Gets and sets the index of the currently selected panel. The first item is at index 0.

 

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.
tabindex
Type: integer
The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence.
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

accessibleType
Type: integer
A value indicating the type of accessibility object for the element.
disabled
Type: boolean
Gets and sets the value of the disabled attribute.
itemCount
Type: integer
Read only property holding the number of child items.
selectedIndex
Type: integer
Returns the index of the currently selected item. You may select an item by assigning its index to this property. By assigning -1 to this property, all items will be deselected. Returns -1 if no items are selected
selectedItem
Type: element
Holds the currently selected item. If no item is currently selected, this value will be null. You can select an item by setting this value. A select event will be sent to the controlling container (i.e. the listbox, richlistbox, radiogroup, etc., not the list item that was selected) when it is changed either via this property, the selectedIndex property, or changed by the user.
tabbox
Type: tabbox element
Returns the tabbox element that contains the tabs.
tabIndex
Type: integer
Gets and sets the value of the tabindex attribute.
value
Type: string
Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax.

 

Methods

Inherited Methods
addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData

advanceSelectedTab( dir, wrap )
Return type: no return value
If the argument <var>dir</var> is set to 1, the currently selected tab changes to the next tab. If the argument <var>dir</var> is set to -1, the currently selected tab changes to the previous tab. If the <var>wrap</var> argument is true, the adjustment will wrap around when the first or last tab is reached.
appendItem( label, value )
Return type: element
Creates a new item and adds it to the end of the existing list of items. You may optionally set a value. The function returns the newly created element.
getIndexOfItem( item )
Return type: integer
Returns the zero-based position of the specified item. Items are numbered starting at the first item displayed in the list.
getItemAtIndex( index )
Return type: element
Returns the element that is at the specified index.
insertItemAt( index, label, value )
Return type: element
This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned.
removeItemAt( index )
Return type: element
Removes the child item in the element at the specified index. The method returns the removed item.

Elements
tabbox, tab, tabpanels, tabpanel.
Interfaces
nsIAccessibleProvider, nsIDOMXULSelectControlElement

Étiquettes et contributeurs liés au document

Étiquettes : 
 Contributeurs à cette page : Sheppy, skomorokh, Allasso, trevorh, Mrolappe, Marsf, Enn, Mgjbot, Pmash, Ptak82, Dria
 Dernière mise à jour par : Sheppy,