多物体的运动和透明度都没有反应, 麻烦帮忙解决一下,谢谢
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
ul,li{
list-style: none;
}
ul li{
width: 200px;
height: 100px;
background:yellow;
margin-bottom:20px;
filter: alpha(opacity:30);
opacity:0.3;
}
</style>
<script type="text/javascript">
window.onload = function(){
var aLi = document.getElementsByTagName('li');
for(var i = 0. i < aLi.length; i++){
aLi[i].alpha = 30;
aLi[i].onmouseover = function(){
startMove(this, 100);
}
aLi[i].onmouseout = function(){
startMove(this, 30);
}
}
}
function startMove(obj, Target){
clearInterval(obj.timer);
obj.timer = setInterval(function(){
var speed = 0;
if(obj.alpha > Taret){
speed = -10;
}
if(obj.alpha < Taret){
speed = 10;
}
if(obj.offsetWidth == Target){
clearInterval(obj.timer);
}
else{
obj.alpha += speed;
obj.style.filter = 'alpha(opacity:' + obj.alpha + ')';
obj.style.opacity = obj.alpha/100;
}
}, 30)
}
/*
window.onload = function(){
var aLi = document.getElementsByTagName('li');
for(var i = 0. i < aLi.length; i++){
aLi[i].onmouseover = function(){
startMove(this, 400);
}
aLi[i].onmouseout = function(){
startMove(this, 200);
}
}
}
//var timer = null;
function startMove(obj, Target){
clearInterval(obj.timer);
obj.timer = setInterval(function(){
var speed = (Target - obj.offsetWidth)/8;
speed = (speed > 0) ? Math.ceil(speed): Math.floor(speed);
if(obj.offsetWidth == Target){
clearInterval(obj.timer);
}
else{
obj.style.width = obj.offsetWidth + speed + 'px';
}
}, 30)
}
*/
</script>
</head>
<body>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>