为什么在IE浏览中透明度没有变化,其他浏览器都可以?
var li2=document.getElementById('li1');
var li3=document.getElementById('li2');
li2.timer1=null;
li3.timer1=null;
li2.alpha=100;
li2.onmouseover=function() {
//onMoveMore(this,'width',400);
onMoveMore(this,'opacity',30)
}
li3.onmouseover=function() {
onMoveMore(this,'height',400);
}
li2.onmouseout=function() {
//onMoveMore(this,'width',200);
onMoveMore(this,'opacity',100);
}
li3.onmouseout=function() {
onMoveMore(this,'height',100);
}
function onMoveMore(obj,attr,iTarget){
clearInterval(obj.timer1);
obj.timer1=setInterval(function(){
var icur=0;
if(attr=='opacity'){
icur=Math.round(parseFloat(getStyle(obj,attr))*100);
//alert(icur)
}else{
icur=parseInt(getStyle(obj,attr));
}
speed=(iTarget-icur)/8;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
if(icur==iTarget){
clearInterval(obj.timer1);
}else{
if(attr=='opacity'){
obj.style.filter='alpha(opacity:'+(icur+speed)+')';
obj.style.opacity=(icur+speed)/100;
}else{
obj.style[attr]=icur+speed+'px';
}
}
},30)
}