![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
20/11/2008, 11:32
|
![Avatar de EPROM](http://static.forosdelweb.com/customavatars/avatar97506_1.gif) | | | Fecha de Ingreso: abril-2005
Mensajes: 51
Antigüedad: 19 años, 9 meses Puntos: 3 | |
Respuesta: Obtener filas de una tabla algo así??
Código:
function cargarDatos(id) {
document.getElementById('id_seleccionado').value = document.getElementById('row'+id).cells[0].innerHTML;
document.getElementById('nombre_seleccionado').value = document.getElementById('row'+id).cells[1].innerHTML;
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="tabla">
<thead>
<tr>
<th>ID</th>
<th>NOMBRES</th>
<th>ACCION</th>
</tr>
</thead>
<tbody>
<tr id="row0">
<td>1</td>
<td>Iván</td>
<td><a href="javascript:cargarDatos(0)">Cargar Input</a></td>
</tr>
<tr id="row1">
<td>2</td>
<td>Ale</td>
<td><a href="javascript:cargarDatos(1)">Cargar Input</a></td>
</tr>
</tbody>
</table>
<br/>
<input type="text" name="id_seleccionado" id="id_seleccionado" value=""/>
<input type="text" name="nombre_seleccionado" id="nombre_seleccionado" value=""/>
|