清除定时器的叠加有什么用?
ar timer=null;
var apha=30;
function changeColor(target){
clearInterval(timer);//就这句代码不懂
var box1=document.getElementById('box1');
timer=setInterval(function(){//为什么这里不要参数
var speed=0;
if(apha>target)
{
speed=-5;
}else{
speed=5;
}
if(apha==target)//什么条件呢
{
clearInterval(timer);
}else{
apha+=speed;
box1.style.filter="alpha(opacity:'+apha+')";
box1.style.opacity=apha/100;
}
},20)
}