為啥使用obj.style[filter]在瀏覽器里會報錯,obj.style[filter]和obj.style.filter不是一樣的嗎?報錯說obj.style[filter]未定義?
if (atr=="opacity") {
obj.style[atr]=(cur+speed)/100;
console.log(obj.style.filter);
console.log(obj.style[filter]);
obj.style.filter='alpha(opacity:'+cur+speed+')';
? //obj.style[filter]='alpha(opacity:'+cur+speed+')';
}else{
obj.style[atr]=cur+speed+"px";
}
2018-05-24
obj.style[filter]改為obj.style['filter'],obj.style.filter === obj.style['filter']