猿问

请问我这是哪错了

<script type="text/javascript">

window.onload = function(){

var ali = document.getElementsByClassName('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,tiger){

clearInterval(timer);

timer = setInterval(function(){

var speed = (tiger - obj.offsetWidth)/8;

speed = speed > 0?Math.ceil(speed):Math.floor(speed);

if(obj.offsetWidth == tiger){

clearInterval(timer);

}

else{

obj.style.width = obj.offsetWidth + speed + 'px';

}

},30)

}

}


慕婉清1004515
浏览 1352回答 2
2回答

队友杀手

可能是tiger 未定义吧
随时随地看视频慕课网APP
我要回答