Latest web development tutorials

HTML DOM Table Object

Table Object

Table object represents an HTML form.

In an HTML document <table> tag appears every time, a Table object is created.


Table Object Collection

W3C: W3C standards.

集合 描述 W3C
cells 返回包含表格中所有单元格的一个数组。 No
rows 返回包含表格中所有行的一个数组。 Yes
tBodies 返回包含表格中所有 tbody 的一个数组。 Yes

Table Object Properties

属性 描述 W3C
align 已废弃. 表在文档中的水平对齐方式。 D
background 已废弃 设置或者返回表格的背景 D
bgColor 已废弃 表格的背景颜色。 D
border 已废弃 设置或返回表格边框的宽度。 instead D
caption 返回表格标题。 Yes
cellPadding 设置或返回单元格内容和单元格边框之间的空白量。 Yes
cellSpacing 设置或返回在表格中的单元格之间的空白量。 Yes
frame 设置或返回表格的外部边框。 Yes
height 已废弃 设置或者返回表格高度 instead D
rules 设置或返回表格的内部边框(行线)。 Yes
summary 设置或返回对表格的描述(概述)。 Yes
tFoot 返回表格的 TFoot 对象。如果不存在该元素,则为 null。 Yes
tHead 返回表格的 THead 对象。如果不存在该元素,则为 null。 Yes
width 已废弃设置或返回表格的宽度。 D

Table Object

方法 描述 W3C
createCaption() 为表格创建一个 caption 元素。 Yes
createTFoot() 在表格中创建一个空的 tFoot 元素。 Yes
createTHead() 在表格中创建一个空的 tHead 元素。 Yes
deleteCaption() 从表格删除 caption 元素以及其内容。 Yes
deleteRow() 从表格删除一行。 Yes
deleteTFoot() 从表格删除 tFoot 元素及其内容。 Yes
deleteTHead() 从表格删除 tHead 元素及其内容。 Yes
insertRow() 在表格中插入一个新行。 Yes

Standard properties and events

Table object also supports the standard attributes and events .