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

Internet explorer No funciona con ajax

Estas en el tema de Internet explorer No funciona con ajax en el foro de Frameworks JS en Foros del Web. Ola de nuevo estoi intentando acer un formulario en ajax he conseguido k me funcione 100% en todos los navegadores menos en el ie donde ...
  #1 (permalink)  
Antiguo 29/12/2008, 10:10
 
Fecha de Ingreso: diciembre-2008
Mensajes: 9
Antigüedad: 15 años, 4 meses
Puntos: 0
Internet explorer No funciona con ajax

Ola de nuevo estoi intentando acer un formulario en ajax he conseguido k me funcione 100% en todos los navegadores menos en el ie donde me ace cosas tan bonitas como esto --> img388.imageshack.us/img388/2959/dibujoym5.jpg

Me descoloca los estilos no me pilla variables etc etc ace cosas realmente raras sin embargo en los otros navegadores funciona a la perfeccion y no se a k se puede deber estes fallos tan catastroficos

En el archivo ajax se encuentran todas estas funciones.
Código:
<script language="JavaScript" type="text/javascript">
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var http = getXMLHTTPRequest();

function llamarajax(tabla,num) {
  var myurl = 'dimehoraXML.php?tab='+tabla;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"&rand="+myRand;
  http.open("GET", modurl, true);
  eval("http.onreadystatechange = useHttpResponse"+num);
  http.send(null);
}
function llamarajax2(tabla,num) {
  var myurl = 'dimehoraXML.php?tab='+tabla;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"&rand="+myRand;
  http.open("GET", modurl, true);
  eval("http.onreadystatechange = useHttpResponse"+num);
  http.send(null);
}

function useHttpResponse1() {
   if (http.readyState == 4) {
    if(http.status == 200) {
     
   document.getElementById('showtime').style.display='';
       document.getElementById('showtime').innerHTML = http.responseText;
    }
  } else {
  document.getElementById('showtime').innerHTML = '<img src="anim.gif">';
  }
}
function useHttpResponse2() {
   if (http.readyState == 4) {
    if(http.status == 200) {
    document.getElementById('showtime').style.display='none';
   document.getElementById('showtime2').style.display='';
       document.getElementById('showtime2').innerHTML = http.responseText;
    }
  } else {
  document.getElementById('showtime2').innerHTML = '<img src="anim.gif">';
  }
}

function useHttpResponse3() 
{
 document.getElementById('showtime2').style.display='none';
 document.getElementById('showtime').style.display='';
document.getElementById('showtime').innerHTML = http.responseText;
document.getElementById('3').style.display='';
document.getElementById('configram3').style.display='';
document.getElementById('configselectram3').style.display='';
}

function useHttpResponse4() 
{
   document.getElementById('showtime2').style.display='none';
 document.getElementById('showtime').style.display='';
document.getElementById('showtime').innerHTML = http.responseText;
document.getElementById('4').style.display='';
document.getElementById('configram4').style.display='';
document.getElementById('configselectram4').style.display='';
}

function useHttpResponse5() 
{
   document.getElementById('showtime2').style.display='none';
 document.getElementById('showtime').style.display='';
document.getElementById('showtime').innerHTML = http.responseText;
document.getElementById('5').style.display='';
document.getElementById('configram5').style.display='';
document.getElementById('configselectram5').style.display='';
}
function useHttpResponse6() 
{
   document.getElementById('showtime2').style.display='none';
 document.getElementById('showtime').style.display='';
document.getElementById('showtime').innerHTML = http.responseText;
document.getElementById('6').style.display='';
document.getElementById('configram6').style.display='';
document.getElementById('configselectram6').style.display='';}
</script>
Arhivo php

Código:
echo'<FORM ALIGN=CENTER NAME="formulario" METHOD="POST" ACTION="#" enctype="multipart/form-data"> '; while($articulo=mysql_fetch_array($resultados)) { if ($articulo[categoria]=="ram") { echo '<DIV id="confignombre"><b>'.$articulo[categoria].'</b></DIV>'; echo'<DIV id="configselect">'; echo' <select name='.$articulo[categoria].' id=0 onChange="llamarajax(this.value,3)" style="width: 520px;" >'; $resultados2 = mysql_query("SELECT * FROM productos where categoria='$articulo[categoria]' "); $total_registros2 = mysql_num_rows($resultados2); echo '<option > </option>'; while($articulo2=mysql_fetch_array($resultados2)) { $id=$articulo2['nome']; echo '<option >'.$id.'</option>'; } echo'</select>'; echo '</DIV>'; for($i = 2; $i <=4; $i ++) { $a=$i+1; $b=$articulo[categoria].$a; $configram="configram".$a; $configselect="configselectram".$a; $c=$a+1; $d=$articulo[categoria].$c; echo '<DIV name='.$configram.' id="'.$configram.'" style="display:none"><b>'.$articulo[categoria].'</b></DIV>'; echo'<DIV id="'.$configselect.'" style="display:none;">'; echo' <select name='.$b.' id="'.$a.'" onChange="llamarajax(this.value,'.$c.')" style="display:none;width: 520px;" >'; $resultados2 = mysql_query("SELECT * FROM productos where categoria='$articulo[categoria]' "); $total_registros2 = mysql_num_rows($resultados2); echo '<option > </option>'; while($articulo2=mysql_fetch_array($resultados2)) { $id=$articulo2['nome']; echo '<option >'.$id.'</option>'; } echo'</select>'; echo '</DIV>'; } } elseif ($articulo[categoria]=="hd"||$articulo[categoria]=="placa"||$articulo[categoria]=="tarxeta") { echo '<DIV id="confignombre"><b>'.$articulo[categoria].'</b></DIV>'; echo'<DIV id="configselect">'; if($articulo[categoria]=="hd") $a=2; echo' <select name='.$articulo[categoria].' id='.$a.' onChange=" llamarajax2(this.value,this.id)" style="width: 520px;" >'; $resultados2 = mysql_query("SELECT * FROM productos where categoria='$articulo[categoria]' "); $total_registros2 = mysql_num_rows($resultados2); echo '<option > </option>'; while($articulo2=mysql_fetch_array($resultados2)) { $id=$articulo2['nome']; echo '<option value="'.$id.'">'.$id.'</option>'; } echo'</select>'; echo '</DIV>'; } else{ echo '<DIV id="confignombre"><b>'.$articulo[categoria].'</b></DIV>'; echo'<DIV id="configselect">'; echo' <select name='.$articulo[categoria].' style="width: 520px;">'; $resultados2 = mysql_query("SELECT * FROM productos where categoria='$articulo[categoria]' "); $total_registros2 = mysql_num_rows($resultados2); echo '<option > </option>'; while($articulo2=mysql_fetch_array($resultados2)) { $id=$articulo2['nome']; echo '<option value="'.$id.'">'.$id.'</option>'; } echo'</select>'; echo '</DIV>'; } echo '<div id="showtime" style="display:none" class="displaybox"> </div>'; if($articulo[categoria]=="hd") { echo '<div id="showtime2" style="display:none" class="displaybox"> </div>'; } } //echo '<INPUT TYPE="SUBMIT" class="ENVIAR" NAME="SUBMIT" VALUE="ENVIAR" >'; echo'</FORM>';
Consulta php
Código:
<?
require('configuracion.php');
$resultados = mysql_query("SELECT 	*  FROM productos where  nome='$_GET[tab]' ");
$total_registros = mysql_num_rows($resultados);  
while($articulo=mysql_fetch_array($resultados))
										{
										echo $articulo['nome'];
										echo "<br>";
										echo $articulo['categoria'];
										echo "<br>";
										echo $articulo['prezo'];
										} 

										
?>
Si alguien sabe a k se puede deber este monton de fallos en el explorer k me ayude por favor
  #2 (permalink)  
Antiguo 29/12/2008, 13:18
Avatar de XLogus  
Fecha de Ingreso: noviembre-2008
Ubicación: AQP
Mensajes: 495
Antigüedad: 15 años, 5 meses
Puntos: 19
Respuesta: Internet explorer No funciona con ajax

Hola
Cita:
¿a k se puede deber estes fallos tan catastroficos?
Pues facil, se debe a que lo programó Microsoft :)

Seria mucho mejor si pudieras subir la página a Internet y envies la URL para poder hacer un debug
  #3 (permalink)  
Antiguo 29/12/2008, 17:11
 
Fecha de Ingreso: diciembre-2008
Mensajes: 9
Antigüedad: 15 años, 4 meses
Puntos: 0
Respuesta: Internet explorer No funciona con ajax

Cita:
Iniciado por XLogus Ver Mensaje
Hola

Pues facil, se debe a que lo programó Microsoft :)

Seria mucho mejor si pudieras subir la página a Internet y envies la URL para poder hacer un debug
Aqui te dejo un link puedes ver la diferencia k ace entre el firefox y el internet explorer 7 en el select del ram se ve claramente la diferencia mientras k el firefox coje la variable el internet explorer coje la variable en blanco mostrando siempre la frase portatiles
99

http://proyectodragon.com/index3.php
  #4 (permalink)  
Antiguo 30/12/2008, 07:32
Avatar de XLogus  
Fecha de Ingreso: noviembre-2008
Ubicación: AQP
Mensajes: 495
Antigüedad: 15 años, 5 meses
Puntos: 19
Respuesta: Internet explorer No funciona con ajax

Internet Explorer marca error en esta linea:
Código:
document.getElementById('showtime').innerHTML = http.responseText;
Error: "El dato para completar la operacion no esta disponible"

Al igual como haces en esa funcion debes colocar ese if para function useHttpResponse3, 4, etc:
Código:
function useHttpResponse2() {
   if (http.readyState == 4) {
  }
}
Y Firefox ademas te detecta un error en esta linea
Código:
document.getElementById('6').style.display='';
Segun parece ese objeto no existe
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 07:37.