Latest web development tutorials

HTML DOM TableHeader objects

TableHeader objects

TableHeader object represents an HTML <th> element.

Object Access TableHeader

You can use getElementById () to access the <th> element:

var x = document.getElementById("myTh"); 尝试一下

Tip: You can also search form cells to access TableHeader collection of objects.

Objects created TableHeader

You can use the document.createElement () method to create a <th> element:

var x = document.createElement("TH"); 尝试一下

TableHeader object properties

属性 描述
abbr 设置或返回 abbr 属性的值。
align HTML5 中不支持。使用 style.textAlign 替代。
设置或返回数据单元格中内容的水平对齐方式。
axis HTML5 中不支持。
设置或返回一个用逗号分隔的相关数据单元格的列表。
background HTML5 中不支持。使用 style.background 替代。
设置或返回数据单元格的背景图像。
bgColor HTML5 中不支持。使用 style.backgroundColor 替代。
设置或返回表格的背景颜色。
ch HTML5 中不支持。
设置或返回数据单元格根据的对齐字符。
chOff HTML5 中不支持。
设置或返回 ch 属性的水平偏移。
colSpan 设置或返回 colspan 属性的值。
headers 设置或返回 headers 属性的值。
height HTML5 中不支持。使用 style.height 替代。
设置或返回数据单元格的高度。
noWrap HTML5 中不支持。使用 style.whiteSpace 替代。
设置或返回单元格中的内容是否折行。
rowSpan 设置或返回 rowspan 属性的值。
vAlign HTML5 中不支持。使用 style.verticalAlign 替代。
设置或返回单元格中内容的垂直对齐方式。
width HTML5 中不支持。使用 style.width 替代。
设置或返回数据单元格的宽度。

Standard properties and events

TableHeader objects also supports standard attributes and events .


related articles

HTML Tutorial: HTML table

HTML Reference Manual: HTML <TH> tag