Foros del Web » Programando para Internet » Javascript » Frameworks JS »

XMLHttpRequest() error con IE7

Estas en el tema de XMLHttpRequest() error con IE7 en el foro de Frameworks JS en Foros del Web. hola, acabo de empezar con javascript, y he probado un minitutorial de ajax que encontre por internet. Funciona perfectamente en firefox, pero con IE7 no ...
  #1 (permalink)  
Antiguo 20/05/2008, 00:44
Avatar de TROQUELADO  
Fecha de Ingreso: abril-2008
Ubicación: Barcelona
Mensajes: 94
Antigüedad: 16 años
Puntos: 0
XMLHttpRequest() error con IE7

hola,

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> 
ajax.js
Código:
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...';
	}
}
y este es el enlace a los archivos del tutorial.

http://www.sofanaranja.com/wp-content/minitutorial-ajax.zip
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:04.