我在控制台查看属性都跑的了, 就是他的效果不显示,很郁闷呀求救
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>拖动</title>
<meta charset="utf-8">
<style type="text/css">
*{margin:0;
padding:0;
}
#div1 {
width: 200px;
height: 200px;
background: red;
filter:alpha(opactiy:100);
opacity: 1;
}
</style>
<script type="text/javascript">
window.onload=function(){
var oDiv = document.getElementById("div1");
oDiv.onmouseover = function(){
starFilter(10);
}
oDiv.onmouseout = function(){
starFilter(100);
}
}
var timer = null,
alpha = 100;
function starFilter(iTarget){
clearInterval(timer);
var oDiv = document.getElementById("div1");
timer = setInterval(function(){
var speed = 0;
if (alpha<iTarget) {
speed = 10;
}else{
speed = -10;
}
if(alpha == iTarget){
clearInterval(timer);
}else{
alpha+=speed;
oDiv.style.filter = 'alpha(opactiy:'+alpha+')';
oDiv.style.opactiy = alpha/100;
console.log(oDiv.style.opactiy);
}
},30)
}
</script>
</head>
<body>
<div id="div1">
</div>
</body>
</html>