Ver Mensaje Individual
  #9 (permalink)  
Antiguo 14/02/2015, 12:23
matrixre9
 
Fecha de Ingreso: julio-2013
Ubicación: Durango, Dgo
Mensajes: 108
Antigüedad: 10 años, 10 meses
Puntos: 8
Respuesta: obtener id de una filla <table>

Exelente tu ayuda sin duda me has resuelto bastante dolor de cabeza :)

mira deje mi codigo asi

Código PHP:
<?php 

include ("leer/Extras/conexion.php"); 

//$con=conexion(); 



$res=mysql_query("select * from revision where estado='REVISION' ORDER BY  fecha_ing ASC limit 20",$con); 

?> 

<center><table  style="font-size:12px" border="8"> 
<tr width="300" height="100" align="center"> 
<th>Folio revision</th> 
<th>Tipo Equipo</th> 
<th>Tipo revision</th> 
<th>Actualizar Antivirus</th> 
<th>Actualizaciones</th> 
<th>cont</th> 
</tr> 

<?php while($fila=mysql_fetch_array($res)){  
//consulta para traer datos del equipo que tiene cada usuario 

/*$res2=mysql_query("select * from equipos where id_trabajador='".$fila[id_trabajador]."'",$con); 

while($fila2=mysql_fetch_array($res2)) 
{*/ 
$cont=$cont+1


?> 

<form> 
<tr width="100" height="30" align="center"> 
<td onClick="funcion()"><?php echo $fila[folio_rev]; ?></a></td> 
<td><?php echo $fila[tipo_equipo]; ?></td> 
<td><?php echo $fila[tipo_rev]; ?></td> 
<td><?php echo $fila[respaldo]; ?></td> 
<td><?php echo $fila[limpieza]; ?></td> 
<td><?php echo $cont ?></td> 
</tr> 
</form> 

<?php }?> 
<script> 
function funcion()
{
document.querySelector("table").addEventListener("click", function(event){ 
    if (event.target.tagName == "TD"){
        window.open("dato.php?variable="+ event.target.innerText,'','width=600,height=400,left=50,top=50,toolbar=yes')

    }
},false);
}

</script>
cambie algo del script y agregue una función al primer <td> y funciona muy bien pero pasa algo curioso, al cargarla pagina la primera vez me respeta e onclick de la función pero al ejecutarla la primera vez ya no me respeta el onclick en cualquier td que le de click ejecuta el script