我的代码哪里有错呢?我怎么排除都实现不了。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>more</title>
<style type="text/css">
ul ,li{
list-style: none;
}
ul li{
width:200px;
height: 100px;
background: yellow;
margin-bottom: 20px;
}
</style>
<script type="text/javascript">
window.onload=function(){
var Ali=document.getElementsByTagName("li");
for(var i=0;i<Ali.length;i++){
Ali[i].onmouseover=function(){
startMove(this,500);
}
Ali[i].onmouseout=function(){
startMove(this,10);
}
}
}
var timer=null;
function startMove(obj,iTarget){
clearInterval(timer);
timer=setInterval(function(){
var speed=(iTarget-obj.offsetwidth)/10;
if(speed=speed>0){ Math.ceil(speed)}
else{
Math.floor(speed);}
if(obj.offsetwidth=iTarget){
clearInterval(timer);
}
else{
obj.style.width=obj.offsetwidth+speed+'px';
}
},30)
}
</script>
</head>
<body>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>