Table tHeadPropiedad
Objeto Table
Definición y uso
La propiedad tHead devuelve una referencia al elemento thead de la tabla.
El elemento thead se utiliza para agrupar el contenido del encabezado de una tabla HTML.
Sintaxis
tableObject.tHead
Compatibilidad con navegadores
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales soportan la propiedad tHead.
Ejemplo
Ejemplo
Mostrar el elemento HTML del <thead> insertado:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de Ejemplo (example.com)</title>
<script>
function displayResult(){
alert(document.getElementById('myTable').tHead.innerHTML);
}
</script>
</head>
<body>
<table id="myTable" border="1">
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>
<br>
<button type="button" onclick="displayResult()">Mostrar texto HTML del encabezado</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de Ejemplo (example.com)</title>
<script>
function displayResult(){
alert(document.getElementById('myTable').tHead.innerHTML);
}
</script>
</head>
<body>
<table id="myTable" border="1">
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>
<br>
<button type="button" onclick="displayResult()">Mostrar texto HTML del encabezado</button>
</body>
</html>
Pruébalo »
Objeto Table Otras extensiones