var?index?=?0;
var?animate?=?function(offset){
return?function(){
var?left?=?parseInt(list.style.left)?+?offset/10;
list.style.left?=?left?+?'px';
if(left?==?0)?list.style.left?=?-3000?+?'px';
alert(index);
if(left?==?index*-600)?clearInterval(interval);
}
}
prev.onclick?=?function(){
interval?=?setInterval(animate(600),100);
index?--;
if(index<0)?index?=?4;
}為什么輸出的 index為4??不是還沒clearInterval嗎??下面的語句就被執(zhí)行了??
setInterval還沒執(zhí)行完index怎么就變了?
上帝子民Chris
2016-10-04 14:14:35