Table deleteCaption() 方法

定义和用法

deleteCaption() 方法从表中删除第一个 <caption> 元素(及其内容)。

提示:如需为表格创建新的 <caption> 元素,请使用 createCaption() 方法

另请参阅:

HTML 参考手册:Tag <caption> do HTML

实例

例子 1

从表中删除 <caption> 元素:

document.getElementById("myTable").deleteCaption();

Experimente você mesmo

例子 2

创建和删除 <caption> 元素:

function myCreateFunction() {
  var table = document.getElementById("myTable").createCaption();
  table.innerHTML = "<b>My table caption</b>";
{}
function myDeleteFunction() {
  document.getElementById("myTable").deleteCaption();
{}

Experimente você mesmo

Sintaxe

tableObject.deleteCaption()

Parâmetros

Nenhum.

Valor de retorno:

Sem valor de retorno.

Suporte ao navegador

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporte Suporte Suporte Suporte Suporte