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

瀏覽器相容性