HTMLTableElement: createTFoot() 方法

Baseline 已广泛支持

此特性已相当成熟,可在许多设备和浏览器版本上使用。自 ⁨2015 年 7 月⁩以来,各浏览器均已提供此特性。

HTMLTableElement 对象的 createTFoot() 方法会返回与给定 <table> 关联的 <tfoot> 元素。如果表中不存在页脚,则此方法会创建它,然后返回它。

注意: 如果不存在页脚,createTFoot() 会直接在表中插入一个新页脚。页脚不需要像使用 Document.createElement() 创建新 <tfoot> 元素时那样单独添加。

语法

js
createTFoot()

参数

无。

返回值

HTMLTableSectionElement

示例

js
let myFoot = myTable.createTFoot();
// Now this should be true: myFoot === myTable.tFoot

规范

规范
HTML
# dom-table-createtfoot-dev

浏览器兼容性