小圆点问题
var prev = document.getElementById('prev');
var next = document.getElementById('next');
var index = 1;
function showButton() {
for (var i = 0;i<buttons.length;i++){
if (buttons[i].ClassName=='on') {
buttons[i].ClassName=='';
}
}
buttons.[index - 1].ClassName='on';
}
function animate(offset){
list.style.left = parseInt(list.style.left)+offset+'px';
}
next.onclick = function(){
animate(-300);
index =index+1;
showButton();
}
prev.onclick = function(){
animate(300);
index =index-1;
showButton();
}
}
为什么我这样写之后不能向左向右移动了,小圆点也不能亮起来