window.onload=function(){
var li=Document.getElementsByTagName("ali");
ali.onmousemover()=function(){
startMove(this,400);
}
ali.onmouseout=function(){
startMove(this,200);
}
}
var timer = null;
function stratMove(obj,iTarget){
clearInterval(obj.timer);
var speed=(iTarget-obj.offsetwidth)/8;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
obj.timer=setInterval(function(){
if(obj.offsetwidth==iTarget){
clearInterval(obj.timer);
}
else{
obj.style.width=obj.offsetwidth+speed+'px';
}
},30)
}
</script>
var li=Document.getElementsByTagName("ali");
ali.onmousemover()=function(){
startMove(this,400);
}
ali.onmouseout=function(){
startMove(this,200);
}
}
你这里用变量li获取了ali了要遍历一次啊,而且是用li【i】来调用事件onmouseover和onmouseout的
是document.getElementsByTagName吧
ali[0].onmousemover()=function(){
startMove(this,400);
}
这样试试呢