HTMLTableElement.createTHead() 方法返回 <thead> element associated with a given <table> . If no header exists in the table, this method creates it, and then returns it.

注意: If no header exists, createTHead() inserts a new header directly into the table. The header does not need to be added separately as would be the case if Document.createElement() had been used to create the new <thead> 元素。

句法

HTMLTableSectionElement = table.createTHead();
					

返回值

HTMLTableSectionElement

范例

let myhead = mytable.createTHead();
// Now this should be true: myhead == mytable.tHead
					

规范

规范 状态 注释
HTML 实时标准
The definition of 'HTMLTableElement: createTHead' in that specification.
实时标准

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
createTHead Chrome Yes Edge 12 Firefox Yes IE Yes Opera Yes Safari Yes WebView Android Yes Chrome Android ? Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android ?

图例

完整支持

完整支持

兼容性未知 ?

兼容性未知

元数据

  • 最后修改: