Właściwość nagłówków TableHeader
Przykład
Zwróć wartość atrybutu headers elementu <th> o identyfikatorze "myTh":
var x = document.getElementById("myTh").headers;
Definicja i użycie
Właściwość headers ustawia lub zwraca wartość atrybutu headers.
Atrybut headers określa listę komórek nagłówka zawierających informacje nagłówka dla bieżącej komórki danych.
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
headers | Yes | Yes | Yes | Yes | Yes |
Składnia
Zwróć właściwość headers:
tableheaderObject.headers
Ustaw właściwość headers:
tableheaderObject.headers = header_ids
Wartości nieruchomości
Value | Description |
---|---|
header_ids | Specifies a space-separated list of id's to one or more header cells the table cell is related to |
Szczegóły techniczne
Wartość zwrotu: | String, zawierający oddzieloną spacjami listę identyfikatorów komórek nagłówka |
---|
Więcej przykładów
Przykład
Wyświetl nagłówki komórek drugiego rzędu:
var table = document.getElementById("myTable");
var txt = "";
var i;
for (i = 0; i < table.rows[1].cells.length; i++) {
txt = txt + table.rows[1].cells[i].headers + "<br>";
}
Przykład
Zmień wartość atrybutu headers elementu <th> o identyfikatorze "myTh":
document.getElementById("myTh").headers = "newValue";
Powiązane strony
Odniesienie HTML: atrybut nagłówków HTML <th>
❮Obiekt nagłówka tabeli