求助!这段代码哪里错了啊?大神指点迷津
<script>
window.onload=function(){
var box=document.getElementsByTagName("div");
var imgs=box.getElementsByTagName("img");
var imgWidth=imgs[0].offsetWidth;
var exposedWidth=300;
var boxWidth=imgWidth+exposedWidth*(imgs.length-1);
box.style.width=boxWidth+"px";
function setImgsPos(){
for(var i=1,len=imgs.length;i<len;i++){
imgs[i].style.left=imgWidth+exposedWidth*(i-1)+"px";
};
}
setImgsPos();
var translate=imgWidth-exposedWidth;
for(var i=0,len=imgs.length;i<len;i++){
(function(i){
imgs[i].onmouseover=function(){
setImgsPos();
for(var j=1,j<=i;j++){
imgs[j].style.left=parseInt(imgs[j].style.left,10)-translate+"px";
};
};
}(i));
};
};
</script>