求大神帮看看哪里写错了? 没有效果
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
body,div{
padding: 0;
margin: 0;
}
#div1{
width: 200px;
height: 200px;
background: red;
filter: alpha(opacity:30);
opacity: 0.3;
}
</style>
<script type="text/javascript">
window.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(iTarget){
clearInterVal(timer);
var oDiv=document.getElementById("div1");
timer=setInterVal(function(){
var speed=0;
if (alpha>iTarget) {
speed=-10;
}
if (alpha<iTarget) {
speed=10;
}
if (oDiv.offsetAlpha==iTarget) {
clearInterVal(timer);
}
else{
alpha+=speed;
oDiv.style.filter='alpha(opacity:'+alpha+')';
oDiv.style.opacity=alpha/100;
}
},30)
}
</script>
</head>
<body>
<div id="div1">s</div>
</body>
</html>