为什么没反应啊
window.onload=function()
{
var oDiv=document.getElementsByTagName('div');
for(var i=0;i<oDiv.length;i++){
//鼠标移入
oDiv[i].timer=null;
oDiv[i].alpha=30;
oDiv[i].onmouseover=function(){
startmove(this,100);
}
//鼠标移出
oDiv[i].onmouseout=function(){
startmove(this,30);
}
}
}
function startmove(obj,target){ //精简参数
clearInterval(obj.timer);
var speed=0;
obj.timer=setInterval(function(){
if(obj.alpha<target){
speed=10;
}
else {
speed=-10;
};
if(obj.alpha==target){
clearInterval(obj.timer);
}
else
{
obj.alpha+=speed; obj.style.filter='alpha(opactiy:'+obj.alpha+')';
obj. obj.style.opacity=obj.alpha/100;
}
},30);
}