求帮我看看 鼠标移出没反应 问题出哪里了?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>透明度的改变 </title>
<style type="text/css">
*{
margin:0px; padding:0px;
}
#box{
width:300px;
height:250px;
filter:alpha(opacity=:30);
opacity:0.3;
background:red;
}
</style>
<script>
window.onload = function()
{
var Obox = document.getElementById("box");
Obox.onmouseover = function()
{
startcharge(100);
}
Obox.onmouseout = function()
{
startcharge(30);
}
var timer = null;
var al = 30;
function startcharge(Target)
{
clearInterval(timer);
var Obox = document.getElementById("box");
timer =setInterval(function(){
var speed = 0;
if(speed >Target)
{
speed = -10;
}
else
{
speed = 10;
}
if( al ==Target)
{
clearInterval(timer);
}
else
{
al+=speed;
Obox.style.opacity = al/100;
Obox.style.filter = "alpha(opacity:"+alpha+")";
}
},30)
}
}
</script>
</head>
<body>
<div id="box"></div>
</body>
</html>