ho mezzo rimediato, ho però un problema che si verifica slo con FireFox, con IE funziona
praticamente firefox si comporta come se onreadystatechage non esistesse o non si verificasse. Potete aiutarmi?
Codice PHP:
function vota(file_id, voto) {
id_file = file_id
//inizializzo ajax
XMLHttp_voto=null
try { (XMLHttp_voto=new ActiveXObject("Msxml2.XMLHTTP"))
} catch(e) {
try { (XMLHttp_voto=new ActiveXObject("Microsoft.XMLHTTP")) }
catch(e) {
XMLHttp_voto=new XMLHttpRequest();
}
}
var url = 'votofile.php';
url = url+'?mode=ajax&id='+id_file+'&voto='+voto+'&number='+Math.random();
XMLHttp_voto.onreadystatechange = function () {
if (XMLHttp_voto.readyState == 4) {
var risposta = XMLHttp_voto.responseText;
ris = risposta.split('|');
var media = (ris[0]);
var voti = (ris[1]);
//coloro le stelline in base alla media
sopra_stelline(document.getElementById('file-'+id_file),media);
var html = "";
for(i = 1; i <= 5; i++) {
if (i <= media) {
html = html+'[img]img/star.gif[/img]';
} else {
html = html+'[img]img/star_white.gif[/img]';
}
}
html = html+'<p id="attendifile-'+id_file+'" class="sfondobianco">Grazie per aver votato</p>\n';
html = html+'<p id="voti-'+id_file+'"class="sfondobianco">Voti: '+voti+'</p>';
document.getElementById("file-"+id_file).innerHTML = html;
document.getElementById("file-"+id_file).onmouseout = "ripristina_stelline("+media+")";
}
}
XMLHttp_voto.open("GET",url);
XMLHttp_voto.send(null);
}
Ricordo: funziona con IE quindi variabili ecc sono tutte correttamente valorizzate