为什么实现不了,求大神帮助,谢谢
window.onload = function(){
var container = document.getElementById('container');
var list = document.getElementById('list');
var prev = document.getElementById('prev');
var next = document.getElementById('next');
var buttons = document.getElementById('buttons').getElementsByTagName('span');
var index = 1;
var animated = false;
function showButton(){
for(var i = 0;i < buttons.length;i++){
buttons[i].className='';}
buttons[index-1].className='on';
}
function move(offset){
animated = ture;
var newleft =parseInt(list.style.left) + offset;
var time = 300;
var jgtime = 10;
var distance = offset/(time/jgtime);
var go=function(){
if((distance>0&&parseInt(list.style.left)<newfelt)||(distance<0&&parseInt(list.style.left)<newleft)){
list.style.left = parseInt(list.style.left) + distance + 'px';
setTimeout(go,jgtime);}
else{
list.style.left = newleft + 'px';
if(newleft<-6000){list.style.left = -1200 + 'px';}
if(newleft>-1200){list.style.left = -6000 + 'px';}
animated = false;
}
}
go();
}
function play(){var timer;
timer=setTimeout(function(){next.onclick;play();},3000)}
function stop(){clearTimeout(timer);}
prev.onclick = function(){
move(1200);
if(index==1){index=5;}
else{index = index - 1;}
showButton();
}
next.onclick = function(){
move(-1200);
if(index==5){index=1;}
else{index = index + 1;}
showButton();
}
for(var i = 0;i<buttons.length;i++){
buttons[i].onclick = function(){
if (animated) {return;}
var myindex=parseInt(this.getAttribute('index'));
var offset = -1200*(myindex-index);
move(offset);
index = myindex;
showButton();
}}
container.onmouseover = stop;
container.onmouseout = play;