❮ Table Object
Example
Insert new row[s] at the first position of a table [and insert a
// Find a
elements] at the 1st and 2nd position of the "new" | ||||||||||||||||||||||||||||||||||||||||||||||||
elements. Tip: Use the deleteRow[] method to remove a row. Browser Support
SyntaxtableObject.insertRow[index] Parameter Values
Technical Details
More ExamplesExampleCreate and delete row[s]: function myCreateFunction[] { function myDeleteFunction[] { Try it Yourself » Related PagesHTML reference: HTML | ||||||||||||||||||||||||||||||||||||||||||||||||
rows | Returns a collection of all |
tBodies | Returns a collection of all |
Table Object Properties
align | Not supported in HTML5. Use style.cssFloat instead. Sets or returns the alignment of a table according to surrounding text | ||
background | Not supported in HTML5. Use style.background instead. Sets or returns the background image of a table | ||
bgColor | Not supported in HTML5. Use style.backgroundColor instead. Sets or returns the background color of a table | ||
border | Deprecated. Use style.border instead. Sets or returns the width of the table border. | ||
caption | Returns the element of a table | ||
cellPadding | Not supported in HTML5. Use style.padding instead. Sets or returns the amount of space between the cell border and cell content | ||
cellSpacing | Not supported in HTML5. Use style.borderSpacing instead. Sets or returns the amount of space between the cells in a table | ||
frame | Not supported in HTML5. Sets or returns which outer-borders [of a table] that should be displayed | ||
height | Not supported in HTML5. Use style.height instead. Sets or returns the height of a table | ||
rules | Not supported in HTML5. Sets or returns which inner-borders [between the cells] that should be displayed in a table | ||
summary | Not supported in HTML5. Sets or returns a description of the data in a table | ||
tFoot | Returns a reference to the element of a table | ||
tHead | Returns a reference to the element of a table
width
| Not supported in HTML5. Use style.width instead. | Sets or returns the width of the table |
Table Object Methods
createCaption[] | Creates an empty element and adds it to the table | ||||||||||
createTFoot[] | Creates an empty element and adds it to the table | ||||||||||
createTHead[] | Creates an empty element and adds it to the table
deleteCaption[]
| Removes the first element from the table
| deleteRow[]
| Removes a row [ | deleteTFoot[]
| Removes the element from the table
| deleteTHead[]
| Removes the element from the table
| insertRow[]
| Creates an empty | |
Standard Properties and Events
The Table object also supports the standard properties and events.
Related Pages
HTML tutorial: HTML Tables
HTML reference: HTML
elements. You can also define a cell as a header for a group of table cells using the element.
How do you create a table in Dom?To create a table object: document. createElement["TABLE"];
How do you fill a table in JavaScript?var table = document. getElementById["myTable"]; var rowNode = document. createElement["tr"]; var cellNode = document. createElement["td"]; var textNode = document.
Chủ Đề |