HTMLTableElement: createTHead() 方法
HTMLTableElement 对象的 createTHead() 方法会返回与给定 <table> 元素关联的 <thead> 元素。如果表格中不存在表头,此方法会创建表头,然后返回它。
注意: 如果不存在表头,createTHead() 会直接将新的表头插入表格中。与使用 Document.createElement() 创建新的 <thead> 元素不同,这里不需要单独添加表头。
语法
js
createTHead()
参数
无。
返回值
HTMLTableSectionElement
示例
js
let myHead = myTable.createTHead();
// Now this should be true: myHead === myTable.tHead
规范
| 规范 |
|---|
| HTML # dom-table-createthead-dev |
浏览器兼容性
加载中…