Propriété summaryde la table
Objet Table
Définition et utilisation
La propriété summary définit ou renvoie le résumé d'une table.
La propriété summary définit ou renvoie le résumé d'une table.
Syntaxe
Définir la propriété summary :
tableObject.summary="texte"
Renvoyer la propriété summary :
tableObject.summary
Astuce :La propriété summary n'a pas de valeur par défaut.
| Valeur | Description |
|---|---|
| text | Texte du résumé |
Prise en charge des navigateurs
![]()
![]()
![]()
![]()
![]()
Tous les principaux navigateurs prennent en charge la propriété summary
Exemple
Exemple
Afficher une alerte avec le résumé de la table :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Exemple(example.com)</title>
<script>
function displayResult(){
alert(document.getElementById('myTable').summary);
}
</script>
</head>
<body>
<table id="myTable" border="1" summary="Par exemple, les employés dans le tableau">
<tr>
<th>Prénom</th>
<th>Nom</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Afficher la description du tableau</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Exemple(example.com)</title>
<script>
function displayResult(){
alert(document.getElementById('myTable').summary);
}
</script>
</head>
<body>
<table id="myTable" border="1" summary="Par exemple, les employés dans le tableau">
<tr>
<th>Prénom</th>
<th>Nom</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Afficher la description du tableau</button>
</body>
</html>
Essayez-le vous-même »
Objet Table Autres extensions