Ciao a tutti.
Mi ritrovo con un problema:
devo far spostare una serie di livelli <div> in alto o in basso in base alla scelta della direzione.
al clic della freccia (su o giu) parte col setInterval() per fare spostare i livelli di 1px ogni 200 ms.
Quando si arriva all'altezza richiesta chiamo clearInterval(ID) per fermare lo spostamento.
Solo che il clearInterval non viene riconosciuto sembra, fatto sta che i livelli non si fermano e continuano a scendere/salire.

Codice PHP:
var count =0;
var 
id 0;
var 
contatore=0;

function 
muovi(n,tot)
{
    if (
==1)
    {
        
// va in su quindi si sposta in giu
        
for (var i=<= tot i++)
        {
            
id=window.setInterval('animaSu()',100);    
        }
    }
    else if (
== )
    {
        
// va in giu quindi si sposta in su
        
for (var i=<= tot i++)
        {
            
id=window.setInterval('animaGiu()',100);    
        }    
    }
}


function 
animaSu()
{    
    var 
maschera window.document.getElementById('maschera');
    var 
divwindow.document.getElementById('motion');
    
div.style.top div.offsetTop+1+"px";
    var 
testo window.document.getElementById('pulsante');
    
count++;
    
testo.innerHTML ='x maschera:'+maschera.offsetTop+" - livello x: "+div.offsetTop+'
 id intervallo: '
+id '; valore count:'count;
    if (
count==130)
    {
        
alert(id);
        
window.clearInterval(id);
        
count=0;
    } 
}


function 
animaGiu()
{
    var 
maschera window.document.getElementById('maschera');
    var 
divwindow.document.getElementById('motion');
    
div.style.top div.offsetTop-1+"px";
    var 
testo window.document.getElementById('pulsante');
    
count++;
    
testo.innerHTML ='x maschera:'+maschera.offsetTop+" - livello x: "+div.offsetTop+'
 id intervallo : '
+id 'valore i:'count;
    if (
count==132)
    {
        
alert(id);
        
clearInterval(id);
        
count=0;
    }
var 
count =0;
var 
id 0;
var 
contatore=0;

function 
muovi(n,tot)
{
    if (
==1)
    {
        
// va in su quindi si sposta in giu
        
for (var i=<= tot i++)
        {
            
id=window.setInterval('animaSu()',100);    
        }
    }
    else if (
== )
    {
        
// va in giu quindi si sposta in su
        
for (var i=<= tot i++)
        {
            
id=window.setInterval('animaGiu()',100);    
        }    
    }
}


function 
animaSu()
{    
    var 
maschera window.document.getElementById('maschera');
    var 
divwindow.document.getElementById('motion');
    
div.style.top div.offsetTop+1+"px";
    var 
testo window.document.getElementById('pulsante');
    
count++;
    
testo.innerHTML ='x maschera:'+maschera.offsetTop+" - livello x: "+div.offsetTop+'
 id intervallo: '
+id '; valore count:'count;
    if (
count==130)
    {
        
alert(id);
        
window.clearInterval(id);
        
count=0;
    } 
}


function 
animaGiu()
{
    var 
maschera window.document.getElementById('maschera');
    var 
divwindow.document.getElementById('motion');
    
div.style.top div.offsetTop-1+"px";
    var 
testo window.document.getElementById('pulsante');
    
count++;
    
testo.innerHTML ='x maschera:'+maschera.offsetTop+" - livello x: "+div.offsetTop+'
 id intervallo : '
+id 'valore i:'count;
    if (
count==132)
    {
        
alert(id);
        
clearInterval(id);
        
count=0;
    }
var 
count =0;
var 
id 0;
var 
contatore=0;

function 
muovi(n,tot)
{
    if (
==1)
    {
        
// va in su quindi si sposta in giu
        
for (var i=<= tot i++)
        {
            
id=window.setInterval('animaSu()',100);    
        }
    }
    else if (
== )
    {
        
// va in giu quindi si sposta in su
        
for (var i=<= tot i++)
        {
            
id=window.setInterval('animaGiu()',100);    
        }    
    }
}


function 
animaSu()
{    
    var 
maschera window.document.getElementById('maschera');
    var 
divwindow.document.getElementById('motion');
    
div.style.top div.offsetTop+1+"px";
    var 
testo window.document.getElementById('pulsante');
    
count++;
    
testo.innerHTML ='x maschera:'+maschera.offsetTop+" - livello x: "+div.offsetTop+'
 id intervallo: '
+id '; valore count:'count;
    if (
count==130)
    {
        
alert(id);
        
window.clearInterval(id);
        
count=0;
    } 
}


function 
animaGiu()
{
    var 
maschera window.document.getElementById('maschera');
    var 
divwindow.document.getElementById('motion');
    
div.style.top div.offsetTop-1+"px";
    var 
testo window.document.getElementById('pulsante');
    
count++;
    
testo.innerHTML ='x maschera:'+maschera.offsetTop+" - livello x: "+div.offsetTop+'
 id intervallo : '
+id 'valore i:'count;
    if (
count==132)
    {
        
alert(id);
        
clearInterval(id);
        
count=0;
    }



any idea??