我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
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,
Examples
(example needed)
Attributes
-
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 thecommand
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.
-
selectedIndex
- Type: integer
- Gets and sets the index of the currently selected panel. The first item is at index 0.
-
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 highertabindex
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.
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, theselectedIndex
property, or changed by the user.
-
value
- Type: string
-
Gets and sets the value of the
value
attribute. Fortextbox
and user editablemenulist
elements, the contents, as visible to the user, are read and set using theTextbox.value
and Menulist.value syntax.
Methods
-
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 istrue
, 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.
Related
- Elements
-
tabbox
,tab
,tabpanels
,tabpanel
. - Interfaces
-
nsIAccessibleProvider
,nsIDOMXULSelectControlElement