這代碼有啥問(wèn)題嗎,為啥23行老是報(bào)錯(cuò)呢
function?arr(obj,json,fn){
var?flag=true??//
clearInterval(obj.timer);
obj.timer=setInterval(function(){
for(var?attr?in?json){
var?icun=0;
//判斷是opacity就parseflaot(取浮點(diǎn)數(shù)),parseInt
if(attr=='opacity'){
icun=Math.round(parseFloat(getstyle(obj,attr))*100)
}else{
icun=parseInt(getstyle(obj,attr));
}
//設(shè)置速度
var?speed=(json[attr]-icun)/20;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
if(json[attr]!=icun){
flag=false
}
if('opacity'){
li.style[attr]=(icun+speed)/100;
}
li.style[attr]=icun+speed+'px';
if(flag){
clearInterval(obj.timer);
if(fn){
fn();
}
}
}
},20);
}
2017-02-24
第22和24行的li應(yīng)為obj