Codice PHP:
function prova(id_oggetto,c_corrente,to_c) {
var obj = document.getElementById(id_oggetto);
var c;
if (c_corrente < to_c) {
c = c_corrente+1;
} else {
c = c_corrente-1;
}
if (c < to_c || c > to_c) {
obj.innerHTML=(c+' '+to_c);
intervallo = setInterval("prova('"+id_oggetto+"',"+c+','+to_c+')',1000);
} else if (c == to_c) {
clearInterval(intervallo);
alert('ok');
return true;
}
}
possibile che continui a darmi un ciclo infinito???
la funzione dovrebbe solamente richiamarsi ogni tot aumentando c_corrente sino a to_c, una volta arrivata si deve fermare