Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/04/2008, 03:01
Avatar de mgusdl
mgusdl
 
Fecha de Ingreso: abril-2007
Ubicación: Malaga, España
Mensajes: 190
Antigüedad: 17 años
Puntos: 5
Re: Cargar menu en la página

Aqui un pequeño ejemplo, siendo menu.htm el archivo que contiene el menu

Código HTML:
<html>
<head>
<script type="text/javascript">
function xmlobj()
  {
  if (window.XMLHttpRequest) return new XMLHttpRequest();
  else if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
  else alert('No se pudo crear el objeto XML');
  }

function cargamenu()
  {
  xo = xmlobj();
  xo.open('GET', 'menu.htm');
  xo.onreadystatechange = function()
    {
    if (xo.readyState == 4) document.getElementById('menu').innerHTML = xo.responseText;
    }
  xo.send(null);
  }
</script>
</head>
<body onLoad="cargamenu()">
<div id="menu"></div>
</body>
</html>