Ver Mensaje Individual
  #10 (permalink)  
Antiguo 27/01/2011, 14:56
Avatar de stramin
stramin
 
Fecha de Ingreso: marzo-2008
Ubicación: Cubil felino
Mensajes: 1.652
Antigüedad: 17 años, 1 mes
Puntos: 336
Respuesta: Incluir html externo en un html

a ver, yo uso esta, no se si alguien tenga otra mejor:

Código Javascript:
Ver original
  1. function GET_HTML() {
  2.     var LINK_xmlhttp = false;
  3.  
  4.     try { LINK_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  5.     catch (e) { try { LINK_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  6.     catch (e) { try { LINK_xmlhttp = new XMLHttpRequest(); }
  7.     catch (e) { LINK_xmlhttp = false; }}}
  8.     if (!LINK_xmlhttp) return null;
  9.  
  10.     LINK_xmlhttp.open("GET", 'menu.php', true);  // AQUI PONES LA URL DE LA PAGINA DEL MENU
  11.     LINK_xmlhttp.onreadystatechange = function() {
  12.         if (LINK_xmlhttp.readyState == 4) {
  13.             areademenu.innerHTML = LINK_xmlhttp.responseText + ' '; // AQUI DEFINES EL AREA DONDE VA EL MENU
  14.         }
  15.     }
  16.     LINK_xmlhttp.send(null);
  17.     return false;
  18. }

Espero que te sirva, si te resulta, felicitaciones! has aprendido lo básico de AJAX :)