Ver Mensaje Individual
  #7 (permalink)  
Antiguo 18/06/2009, 01:15
envasados
 
Fecha de Ingreso: diciembre-2004
Mensajes: 89
Antigüedad: 19 años, 5 meses
Puntos: 0
Respuesta: Cargar paginas en un div

Donde tengo el error?

esta es la pagina principal index.php

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<script type="text/javascript" src="ajax.js"></script>
</head>

<body>
<div id="arriba">A ver si debajo sale algo</div>
<div id="contenido"></div>
<div id="menu"> <?php require_once("menu.php"); ?> </div>
</body>
</html>

este es el menu.php

Código:
<table width="80%" border="0" cellspacing="0" cellpadding="4">
  <tr>
    <th scope="col">Inicio</th>
  </tr>
  <tr>
    <td><a href="javascript:Enviar('equipo.php','contenido')">Equipo</a></td>
  </tr>
  <tr>
    <td>Contacto</td>
  </tr>
  <tr>
    <td>Noticias</td>
  </tr>
  <tr>
    <td>Yeep</td>
  </tr>
</table>

este el archivo ajax.js

Código:
function ajaxFunction() {
var xmlHttp;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
return xmlHttp;
} catch (e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
return xmlHttp;
} catch (e) {
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
return xmlHttp;
} catch (e) {
alert("Tu navegador no soporta AJAX!");
return false;
}}}
}

function Enviar("equipo.php","contenido") {
var
ajax;
ajax = ajaxFunction();

ajax.open("POST", "equipo.php", true);

ajax.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
ajax.onreadystatechange = function()
{

if (ajax.readyState == 4)
{
if (ajax.status==200)
{
document.getElementById("contenido").innerHTML =
ajax.responseText;

}}}
ajax.send(null);
}
y por ultimo la pagina a cargar equipo.php

Código:
<p class="parrafo_tit">Equipo </p>