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.
Your message has been sent to W3Schools.