The Table object represents an HTML table.
For each <table> tag in an HTML document, a Table object is created.
Note: The Table object can also use the properties/methods of:
W3C: W3C Standard.
| Collection | Description | W3C |
|---|---|---|
| cells | Returns a collection of all <td> or <th> elements in a table | No |
| rows | Returns a collection of all <tr> elements in a table | Yes |
| tBodies | Returns a collection of all <tbody> elements in a table | Yes |
| Property | Description | W3C |
|---|---|---|
| align | Deprecated. Sets or returns the alignment of a table according to surrounding text. Use style.textAlign instead | D |
| background | Deprecated. Sets or returns the background image of a table. Use style.background instead | D |
| bgColor | Deprecated. Sets or returns the background color of a table. Use style.backgroundColor instead | D |
| border | Deprecated. Sets or returns the width of the table border. Use style.border instead | D |
| caption | Returns the caption of a table | Yes |
| cellPadding | Sets or returns the amount of space between the cell border and cell content | Yes |
| cellSpacing | Sets or returns the amount of space between the cells in a table | Yes |
| frame | Sets or returns which outer-borders (of a table) that should be displayed | Yes |
| height | Deprecated. Sets or returns the height of a table. Use style.height instead | D |
| rules | Sets or returns which inner-borders (between the cells) that should be displayed in a table | Yes |
| summary | Sets or returns a description of the data in a table | Yes |
| tFoot | Returns a reference to the tfoot element of a table | Yes |
| tHead | Returns a reference to the thead element of a table | Yes |
| width | Deprecated. Sets or returns the width of the table. Use style.width instead | D |
| Method | Description | W3C |
|---|---|---|
| createCaption() | Creates an empty caption element and adds it to the table | Yes |
| createTFoot() | Creates an empty tfoot element and adds it to the table | Yes |
| createTHead() | Creates an empty thead element and adds it to the table | Yes |
| deleteCaption() | Removes the first caption element from the table | Yes |
| deleteRow() | Removes a row from the table | Yes |
| deleteTFoot() | Removes the tfoot element from the table | Yes |
| deleteTHead() | Removes the thead element from the table | Yes |
| insertRow() | Creates an empty tr element and adds it to the table | Yes |
The Table object also supports the standard properties and events.
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.