为啥我的鼠标移出来的效果不显示。。。。。
window.onload = function(){
var box = document.getElementById('box') ;
box.onmouseover = function(){
play(1);
}
box.onmouseout = function(){
play(0.3);
}
}
var alpha = 0.3 ;
function play(target){
var timer = null ;
var box = document.getElementById('box') ;
clearInterval(timer);
timer = setInterval(function(){
var speed = 0 ;
if(alert > target){
speed = -0.1;
}else{
speed = 0.1 ;
}
if(alpha == target){
clearInterval(timer);
}else{
alpha = alpha + speed;
box.style.opacity = alpha;
}
},30);
}
就是看不出是哪里错了。。。。