HTML DOM tabIndex Property
Przykład
Zmień kolejność tabulatorów dla trzech linków:
document.getElementById("myAnchor1").tabIndex = "3";
document.getElementById("myAnchor2").tabIndex = "2";
document.getElementById("myAnchor3").tabIndex = "1";
Więcej przykładów „Wypróbuj sam” poniżej.
Definicja i użycie
Właściwość tabIndex ustawia lub zwraca wartość atrybutu tabindex elementu.
Atrybut tabindex określa kolejność tabulacji elementu (gdy przycisk „tab” jest używany do nawigacji).
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
tabIndex | Yes | Yes | Yes | Yes | Yes |
Składnia
Zwróć właściwość tabIndex:
HTMLElementObject.tabIndex
Ustaw właściwość tabIndex:
HTMLElementObject.tabIndex = number
Wartości nieruchomości
Value | Description |
---|---|
number | Specifies the tabbing order of the element (1 is first). Note: If the number is negative, the element will be removed from the tab order |
Szczegóły techniczne
Wartość zwrotu: | Liczba reprezentująca kolejność tabulacji elementu |
---|
Więcej przykładów
Przykład
Pobierz kolejność tabulacji pierwszego elementu <a> (indeks 0) w dokumencie:
var x = document.getElementsByTagName("A")[0].tabIndex;
document.getElementById("demo").innerHTML = x;
Powiązane strony
Odniesienie HTML: atrybut tabindex HTML
❮ Obiekt elementu