HTML DOM tr propiedad rowIndex
Definición y Uso
rowIndex propiedad devuelve una fila ( filas ) posición (índice de la fila) en una fila del conjunto de mesa.
gramática
Volver propiedades rowIndex:
trObject.rowIndex
Consejo: rowIndex propiedad no tiene un valor predeterminado.
Soporte para el navegador
Todos los principales navegadores soportan la propiedad rowIndex
Ejemplos
Ejemplos
El ejemplo siguiente devuelve la posición de una fila en la tabla:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(x){
alert("Row index is: " + x.rowIndex);
}
</script>
</head>
<body>
<table border="1">
<tr onclick="displayResult(this)">
<td>单击显示行下标</td>
</tr>
<tr onclick="displayResult(this)">
<td>单击显示行下标</td>
</tr>
<tr onclick="displayResult(this)">
<td>单击显示行下标</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(x){
alert("Row index is: " + x.rowIndex);
}
</script>
</head>
<body>
<table border="1">
<tr onclick="displayResult(this)">
<td>单击显示行下标</td>
</tr>
<tr onclick="displayResult(this)">
<td>单击显示行下标</td>
</tr>
<tr onclick="displayResult(this)">
<td>单击显示行下标</td>
</tr>
</table>
</body>
</html>
Trate »
objetos tr