HTML DOM TableHeaderObject
TableHeader Object
The TableHeader object represents an HTML <th> element.
Access a TableHeader Object
You can access a <th> element by using getElementById():
var
x = document.getElementById("myTh");
Try it Yourself
Tip:You can also access the TableHeader object by searching the form'scellscollection.
Create a TableHeader Object
You can create a <th> element by using the document.createElement() method:
var x = document.createElement("TH");
Try it Yourself
TableHeader Object Properties
| Property | Description |
|---|---|
| abbr | Sets or returns the value of the abbr attribute. |
| align |
Not supported in HTML5. Usestyle.textAligninstead. Sets or returns the horizontal alignment of the content within the data cell. |
| axis |
Not supported in HTML5. Sets or returns a comma-separated list of related data cells. |
| background |
Not supported in HTML5. Use
style.backgroundinstead. Sets or returns the background image of the data cell. |
| bgColor |
Not supported in HTML5. Use
style.backgroundColorinstead. Sets or returns the background color of the table. |
| ch |
Not supported in HTML5. Sets or returns the alignment character for the data cell. |
| chOff |
Not supported in HTML5. Sets or returns the horizontal offset of the ch attribute. |
| colSpan | Sets or returns the value of the colspan attribute. |
| headers | Sets or returns the value of the headers attribute. |
| height |
Not supported in HTML5. Usestyle.heightinstead. Sets or returns the height of the data cell. |
| noWrap |
Not supported in HTML5. Use
style.whiteSpaceinstead. Sets or returns whether the content of the cell should wrap. |
| rowSpan | Sets or returns the value of the rowspan attribute. |
| vAlign |
Not supported in HTML5. Usestyle.verticalAligninstead. Sets or returns the vertical alignment of the content within the cell. |
| width |
Not supported in HTML5. Usestyle.widthinstead. Sets or returns the width of the data cell. |
Standard Properties and Events
The TableHeader object also supports standardpropertiesandand events.。
Related Articles
HTML Tutorial:HTML Tables
HTML Reference:HTML <th> Tag
Other Extensions