Vlastnost záhlaví TableHeader
Příklad
Vrátí hodnotu atributu headers prvku <th> s id "myTh":
var x = document.getElementById("myTh").headers;
Definice a použití
Vlastnost headers nastavuje nebo vrací hodnotu atributu headers.
Atribut headers určuje seznam buněk záhlaví obsahující informace záhlaví pro aktuální datovou buňku.
Podpora prohlížeče
Property | |||||
---|---|---|---|---|---|
headers | Yes | Yes | Yes | Yes | Yes |
Syntax
Vraťte vlastnost headers:
tableheaderObject.headers
Nastavte vlastnost headers:
tableheaderObject.headers = header_ids
Hodnoty vlastností
Value | Description |
---|---|
header_ids | Specifies a space-separated list of id's to one or more header cells the table cell is related to |
Technické údaje
Návratová hodnota: | Řetězec obsahující seznam identifikátorů buněk záhlaví oddělených mezerami |
---|
Další příklady
Příklad
Zobrazit záhlaví buněk druhého řádku:
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>";
}
Příklad
Změňte hodnotu atributu headers prvku <th> s id "myTh":
document.getElementById("myTh").headers = "newValue";
Související stránky
HTML reference: HTML <th> headers atribut
❮ Objekt TableHeader