Ver Mensaje Individual
  #27 (permalink)  
Antiguo 03/10/2012, 01:31
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 7 meses
Puntos: 10
Respuesta: Funcion en Paneles

OK, asi lo hago.Y sin embargo con la funcion pulsar si funciona perfectamente:

Código Javascript:
Ver original
  1. var fila= null;
  2. function pulsar(obj, num_usuario) {
  3.   obj.style.background = 'orange';
  4.   if (fila != null && fila != obj)
  5.     fila.style.background = 'white';
  6.   fila = obj;
  7.  window.location ="menu1.php?id="+num_usuario;
  8. }
  9. function filtrar()
  10. {  
  11.     $.ajax({
  12.         data: $("#frm_filtro").serialize()+ordenar,
  13.         type: "POST",
  14.         dataType: "json",
  15.         url: "ajax.php?action=listar",
  16.             success: function(data){
  17.     var html_user ='' ;
  18.     if(data.length > 0){
  19.         $.each(data, function(i,item){
  20.        
  21.        
  22.          
  23.  html_user += '<tr ondblclick="pulsar(this, ' +  String.fromCharCode(39) + item.num_usuario + String.fromCharCode(39)  + ');" >';
  24.  html_user += '<td ><input name="demo" type="radio" value="demo"/></td>';
  25.  html_user += '<td >'+item.num_usuario+'</td>';
  26.  html_user += '<td>'+item.telefono+'</td>';
  27.  html_user += '<td>'+item.nombre+' '+item.apellidos+'</td>';
  28.  html_user += '<td>'+item.poblacion+'</td>';
  29.  html_user += '</tr>';
  30.            
  31.                                  
  32.         });                    
  33.     }
  34.     if(html_user == '') html_user = '<tr><td colspan="4" align="center">No se encontraron registros..</td></tr>';
  35.     $("#data tbody").html(html_user);
  36. }
  37.  
  38.            
  39.       });
  40. }
  41.  
  42. function createAjax(){
  43.    if (window.XMLHttpRequest)
  44.    {
  45.       xmlhttp=new XMLHttpRequest();
  46.    }
  47.    else
  48.    {
  49.       xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  50.    }
  51. }
  52.  
  53. function buscarAparatos()
  54. {
  55.     var num_usuario = 0;
  56.     var elements = document.getElementsByName('demo');
  57.    
  58.     for(var x=0;elements[x];x++){
  59.         if(elements[x].checked){
  60.             num_usuario = elements[x].value;
  61.             break;
  62.         }
  63.     }
  64.    
  65.     createAjax();
  66.     xmlhttp.onreadystatechange=function()
  67.     {
  68.         if (xmlhttp.readyState==4 && xmlhttp.status==200)
  69.         {
  70.             document.getElementById("pestaña1").innerHTML=xmlhttp.responseText;
  71.         }
  72.     }
  73.    xmlhttp.open("GET","listado_aparatos.php?ID=" + num_usuario,true);
  74.    xmlhttp.send(null);
  75. }