tr sectionRowIndexPropiedad
tr Objeto
Definición y uso
La propiedad sectionRowIndex devuelve la posición de una fila en la colección TBODY, THEAD o TFOOTrowsLa posición en la colección
Sintaxis
Devuelve la propiedad sectionRowIndex:
trObject.sectionRowIndex
Consejo:La propiedad sectionRowIndex no tiene un valor predeterminado.
Compatibilidad del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales son compatibles con la propiedad sectionRowIndex.
Ejemplo
Ejemplo
Muestra la posición de la fila en las colecciones de filas THEAD, TBODY y TFOOT:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial para novatos (example.com)</title>
<script>
function displayResult(x){
alert("Section row index is: " + x.sectionRowIndex);
}
</script>
</head>
<body>
<table border="1">
<thead>
<tr onclick="displayResult(this)">
<th>Haz clic para mostrar el índice de la fila</th>
</tr>
<tr onclick="displayResult(this)">
<th>Haz clic para mostrar el índice de la fila</th>
</tr>
</thead>
<tbody>
<tr onclick="displayResult(this)">
<td>Haz clic para mostrar el índice de la fila</td>
</tr>
<tr onclick="displayResult(this)">
<td>Haz clic para mostrar el índice de la fila</td>
</tr>
</tbody>
<tfoot>
<tr onclick="displayResult(this)">
<td>Haz clic para mostrar el índice de la fila</td>
</tr>
<tr onclick="displayResult(this)">
<td>Haz clic para mostrar el índice de la fila</td>
</tr>
</tfoot>
</table>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial para novatos (example.com)</title>
<script>
function displayResult(x){
alert("Section row index is: " + x.sectionRowIndex);
}
</script>
</head>
<body>
<table border="1">
<thead>
<tr onclick="displayResult(this)">
<th>Haz clic para mostrar el índice de la fila</th>
</tr>
<tr onclick="displayResult(this)">
<th>Haz clic para mostrar el índice de la fila</th>
</tr>
</thead>
<tbody>
<tr onclick="displayResult(this)">
<td>Haz clic para mostrar el índice de la fila</td>
</tr>
<tr onclick="displayResult(this)">
<td>Haz clic para mostrar el índice de la fila</td>
</tr>
</tbody>
<tfoot>
<tr onclick="displayResult(this)">
<td>Haz clic para mostrar el índice de la fila</td>
</tr>
<tr onclick="displayResult(this)">
<td>Haz clic para mostrar el índice de la fila</td>
</tr>
</tfoot>
</table>
</body>
</html>
Pruébalo »
tr Objeto Otras extensiones