Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/07/2015, 11:38
Avatar de alexkurban
alexkurban
 
Fecha de Ingreso: mayo-2015
Ubicación: Minsk
Mensajes: 48
Antigüedad: 9 años
Puntos: 4
Respuesta: con un click obtener el index de una tabla

Me vale con mostrar el index y el ejemplo que me jas puesto del rowIndex me ha venido de perlas, supongo que si tal lo puedo cambiar al alert si necesita verlo en una alerta. Si habria que imprimirlo en el mismo documento, como seria?

<table>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
</table>

<script>
function myFunction(x) {
console.log("Row index is: " + x.rowIndex);
}
</script>