Table deleteCaption() 方法
定義和用法
deleteCaption()
方法從表中刪除第一個 <caption> 元素(及其內容)。
提示:如需為表格創建新的 <caption> 元素,請使用 createCaption() 方法。
另請參閱:
HTML 參考手冊:HTML <caption> 標簽
實例
例子 1
從表中刪除 <caption> 元素:
document.getElementById("myTable").deleteCaption();
例子 2
創建和刪除 <caption> 元素:
function myCreateFunction() { var table = document.getElementById("myTable").createCaption(); table.innerHTML = "<b>My table caption</b>"; } function myDeleteFunction() { document.getElementById("myTable").deleteCaption(); }
語法
tableObject.deleteCaption()
參數
無。
返回值:
無返回值。
瀏覽器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 |