acabo de empezar con javascript, y he probado un minitutorial de ajax que encontre por internet. Funciona perfectamente en firefox, pero con IE7 no me funciona, alguien me puede echar una mano?
el codigo es el siguiente:
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Mini-tutorial AJAX</title> <script src="ajax.js" language="JavaScript"></script> <style> #detalles { margin: 20px; border: 1px solid #F0F0F0; padding: 10px; font-size: 10px; } </style> </head> <body> <h4>Mini-tutorial AJAX</h4> <select onchange="cargaXML(this.value)"> <option value="">Elige...</option> <option value="001.html">001</option> <option value="002.html">002</option> <option value="003.html">003</option> </select> <div id="detalles"> </div> </body> </html>
Código:
y este es el enlace a los archivos del tutorial.var isIE = false;
var req;
function cargaXML(url)
{
if(url=='')
{
return;
}
if (window.XMLHttpRequest)
{
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
}
else if (window.ActiveXObject)
{
isIE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req)
{
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}
function processReqChange()
{
var detalles = document.getElementById("detalles");
if(req.readyState == 4)
{
detalles.innerHTML = req.responseText;
}
else
{
detalles.innerHTML = '<img src="loading.gif" align="middle" /> Loading...';
}
}
http://www.sofanaranja.com/wp-content/minitutorial-ajax.zip

