tr
elementthead
element.tbody
element.tfoot
element.table
element, after any caption
, colgroup
, and thead
elements, but only if there are no tbody
elements that are children of the table
element.td
or th
elementsinterface HTMLTableRowElement : HTMLElement { readonly attribute long rowIndex; readonly attribute long sectionRowIndex; readonly attribute HTMLCollection cells; HTMLElement insertCell(in optional long index); void deleteCell(in long index); };
The tr
element represents a row of cells in a table.
rowIndex
Returns the position of the row in the table's rows
list.
Returns −1 if the element isn't in a table.
sectionRowIndex
Returns the position of the row in the table section's rows
list.
Returns −1 if the element isn't in a table section.
cells
Returns an HTMLCollection
of the td
and th
elements of the row.
insertCell
( [ index ] )Creates a td
element, inserts it into the table row at the position given by the argument, and returns the td
.
The position is relative to the cells in the row. The index −1, which is the default if the argument is omitted, is equivalent to inserting at the end of the row.
If the given position is less than −1 or greater than the number of cells, throws an INDEX_SIZE_ERR
exception.
deleteCell
(index)Removes the td
or th
element with the given position in the row.
The position is relative to the cells in the row. The index −1 is equivalent to deleting the last cell of the row.
If the given position is less than −1 or greater than the index of the last cell, or if there are no cells, throws an INDEX_SIZE_ERR
exception.