createTHead() 方法用于在表格中獲取或創(chuàng)建 <thead> 元素。
tableObject.createTHead()
返回一個(gè) TableSection,表示該表的 <thead> 元素。如果該表格已經(jīng)有了表頭,則返回它。如果該表沒有表頭,則創(chuàng)建一個(gè)新的空 <thead> 元素,把它插入表格,并返回它。
下面的例子為表格創(chuàng)建了一個(gè)腳注:
<html>
<head>
<script type="text/javascript">
function createCaption()
{
var x=document.getElementById('myTable').createTHead()
x.innerHTML="My table head"
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="createCaption()"
value="Create caption">
</body>
</html>
如對(duì)本文有疑問,請(qǐng)?zhí)峤坏浇涣髡搲瑥V大熱心網(wǎng)友會(huì)為你解答!! 點(diǎn)擊進(jìn)入論壇
Powered by 365建站網(wǎng) RSS地圖 HTML地圖
copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號(hào)