總是報錯,小黃點不能點~球解決~~~
window.onload=function(){
? ?var con=document.getElementById('con');
? ?var list=document.getElementById('list');
? ?var button=document.getElementById('button').getElementsByClassName('span');
? ?var prev=document.getElementById('prev');
? ?var next=document.getElementById('next');
? ?var index=1;
? ?function showButton(){
? ? ? ?button[index-1].className='on';
? ?}
? ?function animate(offset){
? ? ? ?var newleft=parseInt(list.style.left) +offset;
? ? ? ?list.style.left = newleft+ 'px';
? ? ? ?if(newleft>-730){
? ? ? ? ? ?list.style.left=-3650+'px';
? ? ? ?}
? ? ? ?if(newleft<-3650){
? ? ? ? ? ?list.style.left=-730+'px';
? ? ? ?}
? ?}
? ?next.onclick=function() {
? ? ? ?index += 1;
? ? ? ?showButton();
? ? ? ?animate(-730);
? ?}
? ?prev.onclick=function() {
? ? ? ?index -= 1;
? ? ? ?showButton();
? ? ? ?animate(730);
? ?}
}
2016-01-03
for (var i = 0; i < buttons.length; i++) {
? ? ? ? ? ? ? ? buttons[i].onclick = function(){
? ? ? ? ? ? ? ? ? ? if (this.className == 'on') {
? ? ? ? ? ? ? ? ? ? ? ? return;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? var myIndex = this.getAttribute('index');
? ? ? ? ? ? ? ? ? ? offset = -600 *(myIndex - index);
? ? ? ? ? ? ? ? ? ? animate(offset);
? ? ? ? ? ? ? ? ? ? index = myIndex;
? ? ? ? ? ? ? ? ? ? showbutton();
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
加上這些