Salve a tutti, ho un problemino da risolvere, ho il codice ajax che aggiorna un div di nome timer, questa funzione ajax, lavora bene con tutti i browser tranne che con internet explorer, il codice è il seguente:
Vorrei capire il perchè funziona con tutti i browser tranne che con ie, qualcuno saprebbe rispondermi o suggerire una soluzione migliore? Grazie infinite anticipatamente.codice:function Aggiorna() { return Richiesta(); } window.setInterval("Aggiorna()", 1000) var XMLHTTP; function Richiesta() { XMLHTTP = RicavaBrowser(CambioStato); XMLHTTP.open("GET", "countdown.asp", true); XMLHTTP.send(null); } function CambioStato() { if (XMLHTTP.readyState == 4) { var R = document.getElementById("timer"); R.innerHTML = XMLHTTP.responseText; } } function RicavaBrowser(QualeBrowser) { if (navigator.userAgent.indexOf("MSIE") != (-1)) { var Classe = "Msxml2.XMLHTTP"; if (navigator.appVersion.indexOf("MSIE 5.5") != (-1)); { Classe = "Microsoft.XMLHTTP"; } try { OggettoXMLHTTP = new ActiveXObject(Classe); OggettoXMLHTTP.onreadystatechange = QualeBrowser; return OggettoXMLHTTP; } catch(e) { alert("Errore: l'ActiveX non verrà eseguito!"); } } else if (navigator.userAgent.indexOf("Mozilla") != (-1)) { OggettoXMLHTTP = new XMLHttpRequest(); OggettoXMLHTTP.onload = QualeBrowser; OggettoXMLHTTP.onerror = QualeBrowser; return OggettoXMLHTTP; } else { alert("L'esempio non funziona con altri browser!"); } }

Rispondi quotando
