HTML DOM TableRow Object

TableRow Object

The TableRow object represents the HTML <tr> element.

Access TableRow Object

You can access the <tr> element using getElementById():

var x = document.getElementById("myTr");

Try It Yourself

Tip:You can also search the table's rows Collection to access the <tr> element.

Create TableRow Object

You can create a <tr> element using the document.createElement() method:

var x = document.createElement("TR");

Try It Yourself

TableRow Object Collection

Collection Description
cells Return a collection of all <td> or <th> elements within the table row.

TableRow Object Properties

Properties Description
align

Not supported in HTML5.Please use style.textAlign.

Set or return the horizontal alignment of the content within the table row.

bgColor

Not supported in HTML5.Please use style.backgroundColor.

Set or return the background color of the table row.

ch

Not supported in HTML5.

Set or return the alignment character of the cell in the table row.

chOff

Not supported in HTML5.

Set or return the horizontal offset of the ch attribute.

height

Not supported in HTML5.Please use style.height.

Set or return the height of the table row.

rowIndex Return the position of the row in the row collection of the table.
sectionRowIndex Return the position of the row in the rows collection of tbody, thead, or tfoot.
vAlign

Not supported in HTML5.Please use style.verticalAlign.

Set or return the vertical alignment of the content within the table row.

TableRow Object Methods

Method Description
deleteCell() Delete a cell from the current table row.
insertCell() Insert a cell into the current table row.

Standard properties and events

The TableRow object supports both standardPropertiesAndEvents.

Related Pages

HTML Tutorial:HTML Table

HTML Reference Manual:HTML <tr> Tag