最新回答 / 蔥匆行天下
你的buttons變量應該指的是這個ul元素下的所有li元素,那么這行代碼<...code...>中的this指向的就是第i個li元素,所有獲取index屬性時會返回為NaN,另外index是不符合規范的屬性,如果一定要用的話建議加上“data-”前綴
2016-08-15
最新回答 / __LLLLLINKT_0
window.onload = function() { index=1;//當前頁碼 len=5;//圖片張數 btn = document.getElementsByTagName("span");//獲得眾多小圓點元素 document.getElementsByTagName("span")[0].className="active";//設置第一個小圓點樣式為active for(var...
2016-08-12
最新回答 / 肖小波
把按鈕的背景圖先display:none隱藏掉,然后你的index到哪一張大圖的時候給對應大圖的按鈕背景圖添加一個div{display:block}就行了
2016-08-11
最新回答 / Echo_Chien
<!doctype html><html><head><meta charset="utf-8"><title>無標題文檔</title><style>#ab{ width:100%; height:600px;position:absolute;}#ba{ width:600px; height:500px; border:1px solid rgba(102,153,153,1); margin:0 auto;posi...
2016-08-08
最贊回答 / lind
原先就只有一個小圓點亮著,點擊按鈕,index的值發生變化,執行showButtons()函數,for循環執行找到亮起來的圓點,然后把他熄滅,break直接跳出循環執行buttons[index-1].className = 'on';使相對應的圓點亮起。
2016-08-04