Table deleteCaption() 方法
定义和用法
deleteCaption() 方法用于删除表格的 caption 元素及其内容。
提示: 在表格中创建新的标题请使用 createCaption() 方法。
语法
tableObject.deleteCaption()
浏览器支持




所有主要浏览器都支持 deleteCaption() 方法
实例
下面的例子删除表格的标题:
<html>
<head>
<script>
function displayResult()
{
document.getElementById("myTable").deleteCaption();
}
</script>
</head>
<body>
<table id="myTable" border="1">
<caption>This is a table caption</caption>
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Delete caption</button>
</body>
</html>