Tableau tHeadPropriété
Objet Table
Définition et utilisation
La propriété tHead renvoie une référence à l'élément thead du tableau.
L'élément thead est utilisé pour regrouper le contenu d'en-tête d'un tableau HTML.
Syntaxe
tableObject.tHead
Prise en charge des navigateurs
![]()
![]()
![]()
![]()
![]()
Tous les principaux navigateurs prennent en charge la propriété tHead.
Exemple
Exemple
Afficher l'élément HTML inséré dans <thead> :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
alert(document.getElementById('myTable').tHead.innerHTML);
}
</script>
</head>
<body>
<table id="myTable" border="1">
<thead>
<tr>
<th>Mois</th>
<th>Épargne</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Somme</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Janvier</td>
<td>$100</td>
</tr>
<tr>
<td>Février</td>
<td>$80</td>
</tr>
</tbody>
</table>
<br>
<button type="button" onclick="displayResult()">Afficher le texte HTML de l'en-tête</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
alert(document.getElementById('myTable').tHead.innerHTML);
}
</script>
</head>
<body>
<table id="myTable" border="1">
<thead>
<tr>
<th>Mois</th>
<th>Épargne</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Somme</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Janvier</td>
<td>$100</td>
</tr>
<tr>
<td>Février</td>
<td>$80</td>
</tr>
</tbody>
</table>
<br>
<button type="button" onclick="displayResult()">Afficher le texte HTML de l'en-tête</button>
</body>
</html>
Essayez-le vous-même »
Objet Table Autres extensions