Ver Mensaje Individual
  #6 (permalink)  
Antiguo 15/08/2012, 10:19
PepeF
 
Fecha de Ingreso: julio-2012
Mensajes: 276
Antigüedad: 11 años, 9 meses
Puntos: 27
Respuesta: actualizar solo una parte de la pagina

prueba esto:

Código HTML:
Ver original
  1. <meta http-equiv="refresh" content="1">
  2.     <title>Actualizador BD</title>
  3.     <script>
  4.         /*
  5. * Parametros mandatorios
  6. */
  7.     var seconds = 60; // el tiempo en que se refresca
  8.     var divid = "tabla"; // el div que quieres actualizar!
  9.     var nocacheurl = 'tabla.php';
  10.    
  11.     //var url = "tabla.php"; // el archivo que ira en el div
  12.  
  13.     function refreshdiv(){
  14.  
  15.         // The XMLHttpRequest object
  16.  
  17.         var xmlHttp;
  18.         try{
  19.             xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
  20.         }
  21.         catch (e){
  22.             try{
  23.                 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
  24.             }
  25.             catch (e){
  26.                 try{
  27.                     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  28.                 }
  29.                 catch (e){
  30.                     alert("Tu explorador no soporta AJAX.");
  31.                     return false;
  32.                 }
  33.             }
  34.         }
  35.  
  36.         // Timestamp for preventing IE caching the GET request
  37.         var timestamp = parseInt(new Date().getTime().toString().substring(0, 10));
  38.        
  39.  
  40.         // The code...
  41.  
  42.         xmlHttp.onreadystatechange=function(){
  43.             if(xmlHttp.readyState== 4 && xmlHttp.readyState != null){
  44.                 document.getElementById(divid).innerHTML=xmlHttp.responseText;
  45.                 setTimeout('refreshdiv()',seconds*1000);
  46.             }
  47.         }
  48.         xmlHttp.open("GET",nocacheurl,true);
  49.         xmlHttp.send(null);
  50.     }
  51.  
  52.     // Empieza la función de refrescar
  53.  
  54.     window.onload = function(){
  55.         refreshdiv(); // corremos inmediatamente la funcion
  56.     }
  57.    
  58.     function Datos(){
  59.         //var alerta= "";
  60.         //confirm(alerta );
  61.         nocacheurl='tabladatos.php';
  62.     }
  63.    
  64.     function Voz(){
  65.         //var alerta= "";
  66.         //alert(alerta);
  67.         nocacheurl = 'tablavoz.php';
  68.     }
  69.     function Mintic(){
  70.         //var alerta= "";
  71.         //alert(alerta);
  72.         nocacheurl = 'tablamintic.php';
  73.     }
  74.     function InfoTicket(){
  75.         //var alerta= "";
  76.         //alert(alerta);
  77.         nocacheurl = 'tablainfo_ticket.php';
  78.     }
  79.     function SoporteOS(){
  80.         //var alerta= "";
  81.         //alert(alerta);
  82.         nocacheurl = 'tablasoporte.php';
  83.          
  84.     }
  85.     function MCF(){
  86.         //var alerta= "";
  87.         //alert(alerta);
  88.         nocacheurl = 'tablamcf.php';
  89.     }
  90.     function ActualizarInfo(){
  91.         //var alerta= "";
  92.         //alert(alerta);
  93.         nocacheurl = 'tablaactualizar_info.php';
  94.     }
  95.     function DiaAnterior(){
  96.         //var alerta= "";
  97.         //alert(alerta);
  98.         nocacheurl = 'tabladia_anterior.php';
  99.     }
  100.  
  101.    
  102. </script>  
  103.  
  104.  
  105. </head>
  106. <body >
  107. <!--alerta.gif --> 
  108.     <?php
  109.    
  110.         $botones='
  111.         <div id="Principal" align="center">
  112.         <button id="MCF(" onclick="MCF()" class="tabla1"> MCCF </button>
  113.         <button id="Voz" onclick="Voz()" class="tabla1"> Voz </button>
  114.         <button id="Datos" onclick="Datos()" class="tabla1"> Datos </button>
  115.         <button id="Mintic" onclick="Mintic()" class="tabla1"> Mintic </button>
  116.         <button id="DiaAnterior" onclick="DiaAnterior()" class="tabla2">Resumen Mes por dias</button>
  117.         <br></br><img src="images/informe.jpg" width="280" height="90" align="center">
  118.         </div>';
  119.         echo $botones;
  120.        
  121.         echo '<div id="tabla">' ;
  122.         echo "</div>";
  123.        
  124.  
  125.        
  126.     ?>
  127.    
  128.  
  129. </body>
  130. </html>