为什么不显示透明呢 ?麻烦帮我看下!谢谢
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
body,div{
margin:0;
padding:0;
}
#div1{
width:200px;
height:200px;
background-color:red;
filter:alpha(opacity:30);//透明度30
opacity:0.3;
}
</style>
<script type="text/jscript">
window.onload=function(){
var oDiv=document.getElementById("div1");
//鼠标移入透明度100
oDiv.onmouseover=function(){
starMove(100);
}
//鼠标移出透明度30
oDiv.onmouseout=function(){
starMove(30);
}
}
var timer=null;
var alpha=30;
function starMove(iTaget){
var oDiv=document.getElementById("div1");
clearInterval(timer);
timer=setInterval(function(){
var speed=0;//变量初始值为0;
if(alpha>=iTaget){
speed=-10;
}
else{
speed=10;
}
if(alpha==iTaget){
clearInterval(timer);
}
else{
alpha+=speed;
odiv.style.filter="alpha(opacity:‘+alpha+')";
oDiv.style.opacity=alpha/100;
}
},30)
}
</script>
</head>
<body>
<div id="div1"></div>
</body>
</html>