HTML DOM deleteCaption() 方法
定義和用法
deleteCaption() 方法用于刪除表格的 caption 元素及其內(nèi)容。
語法
tableObject.deleteCaption()
說明
如果該表有 <caption> 元素,則從文檔樹種刪除它。否則,什么也不做。
實例
下面的例子刪除表格的標題:
<html>
<head>
<script type="text/javascript">
function deleteCaption()
{
document.getElementById('myTable').deleteCaption()
}
</script>
</head>
<body>
<table id="myTable" border="1">
<caption>My table caption</caption>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="deleteCaption()"
value="Delete caption" />
</body>
</html>