点击箭头切换时,页面会自动刷新,left值恢复到初始设置,只有快速点击箭头时才会切换图片,请问该怎么解决呢?window.onload = function(){ var container = document.getElementById('container'), list = document.getElementById('list'), buttons = document.getElementById('buttons').getElementsByTagName('span'), prev = document.getElementById('prev'), next = document.getElementById('next'); prev.onclick = function(){ list.style.left = parseInt(list.style.left) + 600 +'px'; } next.onclick = function(){ list.style.left = parseInt(list.style.left) - 600 +'px'; }} |