Ho individuato il problema, ma non riesco a risolverlo:
la trasmissione ajax funziona, come pure la funzione setInterval per il refresh.
Non so per quale motivo, il contenuto del div non viene aggiornato in explorer.
Anche modificando il codice in questo modo funziona correttamente in firefox, ma non in explorer.
Codice PHP:
<!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 senza titolo</title>
<meta http-equiv="pragma" content="no-cache">
<script type="text/javascript">
function el(name_ID){
return (document.all)?document.all[name_ID]:(document.layers)?document.layers[name_ID]:document.getElementById(name_ID)
}
function scrivi_in(tuo_id, cosa){
if(document.layers){
el(tuo_id).document.write(cosa)
el(tuo_id).document.close()
}
else if(typeof(el(tuo_id).innerHTML)!='undefined'){
el(tuo_id).innerHTML=cosa
}
else alert('funzione non supportata dal browser in uso')
}
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function sndReq() {
http.open('get','leggi_server.php');
http.onreadystatechange = handleResponse;
http.send(null);
}
function handleResponse() {
if(http.readyState == 4){
var response = http.responseText;
if(response){
scrivi_in('contenitore', response)
}
}
}
window.onload = function inizializza(){
setInterval('sndReq()',2000);
}
</script>
</head>
<body>
<div id="contenitore" style="position:absolute;top:100px;left:100px;"></div>
[url="#"]scrivi: ciao[/url]
<meta http-equiv="pragma" content="no-cache">
</body>
</html>