按照视频中的代码。写的一摸一样,为什么在IE浏览器中还是运行不了呢,代码没问题啊,检查好几遍了
<script>
winddow.onload=function(){
var oDiv=document.getElementById('div1');
oDiv.onmouseover=function(){
startMove(100);
}
oDiv.onmouseout=function(){
startMove(30);
}
}
var timer=null;
var alpha=30;
function startMove(Target){
var oDiv=document.getElementById('div1');
clearInterval(timer);
timer = setInterval(function(){
var speed;
if(alpha>Target){
speed=-10;
}
else{
speed=10;
}
if(alpha==Target){
clearInterval(timer);
}
else{
alpha=alpha+speed;
oDiv.style.filter='alpha(opacity:'+alpha+')';
}
},30);
}
</script>