Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Table Object

HTML DOM Table Object


Table object

The Table object represents an HTML table.

In an HTML document,


Table Object Collections

W3C: W3C standard.

A Table object is created each time the tag appears.
Union Description W3C
cells Returns an array containing all the cells in the table. No
rows Returns an array containing all the rows in the table. Yes
tBodies Returns an array containing all the tbody elements in the table. Yes

Table Object Properties

property Description W3C
align Deprecated. The horizontal alignment of the table in the document. D
background Deprecated. Sets or returns the background of the table D
bgColor Deprecated. The background color of the table. D
border Deprecated. Sets or returns the width of the table border. instead D
caption Returns the table caption. Yes
cellPadding Sets or returns the amount of space between the cell content and the cell border. Yes
cellSpacing Sets or returns the amount of space between cells in the table. Yes
frame Sets or returns the outer border of the table. Yes
height Deprecated. Sets or returns the table height. instead D
rules Sets or returns the inner border of the table (row lines). Yes
summary Sets or returns the description (overview) of the table. Yes
tFoot Returns the TFoot object of the table. If the element does not exist, it is null. Yes
tHead Returns the THead object of the table. If the element does not exist, it is null. Yes
width Deprecated. Sets or returns the width of the table. D

Table Object Methods

Method Description W3C
createCaption() Creates a caption element for the table. Yes
createTFoot() Creates an empty tFoot element in the table. Yes
createTHead() Creates an empty tHead element in the table. Yes
deleteCaption() Deletes the caption element and its content from the table. Yes
deleteRow() Deletes a row from the table. Yes
deleteTFoot() Deletes the tFoot element and its content from the table. Yes
deleteTHead() Deletes the tHead element and its content from the table. Yes
insertRow() Inserts a new row into the table. Yes

Standard properties and events

The Table object also supports standard property and Events.