méthode HTML DOM Tableau deleteCaption ()
Définition et utilisation
méthode deleteCaption () est utilisée pour supprimer un élément table de légende et son contenu.
Astuce: Créer unnouveau titre dans l'utilisation de la table createCaption () méthode.
grammaire
tableObject.deleteCaption()
support du navigateur
Tous les principaux navigateurs supportent deleteCaption méthode ()
Exemples
Exemples
L'exemple suivant supprime les titres du tableau:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("myTable").deleteCaption();
}
</script>
</head>
<body>
<table id="myTable" border="1">
<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()">删除标题</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("myTable").deleteCaption();
}
</script>
</head>
<body>
<table id="myTable" border="1">
<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()">删除标题</button>
</body>
</html>
Essayez »
Table Object