if(attr=='opacity'){
obj.style.filter='alpha(opacity:'+(icur+speed)+')';
obj.style[attr]= (icur+speed)/100;} // 也可以这么写
else{obj.style[attr] = icur+speed+'px';}
obj.style.filter='alpha(opacity:'+(icur+speed)+')';
obj.style[attr]= (icur+speed)/100;} // 也可以这么写
else{obj.style[attr] = icur+speed+'px';}
2016-06-27
把判断值改成取绝对值就可以解决溢出的BUG
if (Math.abs(div1.offsetLeft-ofle)>200){
clearInterval(timer);
}else{
div1.style.left=div1.offsetLeft+speem+'px';
}
if (Math.abs(div1.offsetLeft-ofle)>200){
clearInterval(timer);
}else{
div1.style.left=div1.offsetLeft+speem+'px';
}
2016-06-26