講師源代碼在哪里下載?我的為什么箭頭不動
? <script type="text/javascript">
window.onload=function(){
? ? ? ? ? ? var container =document.getElementById('container');//定義變量container,獲取id為container的容器
? ? ? ? ? ? var list = document.getElementById('list');//定義變量list,獲取id為list的圖片列表
? ? ? ? ? ? var buttons = document.getElementById('buttons').getElementsByTagName('span');//定義變量buttons,獲取id為buttons容器下名為span的按鈕
? ? ? ? ? ? var prev =document.getElementById('prev');//定義變量prev,獲取id為prev的箭頭
? ? ? ? ? ? var next = document.getElementById('next');//定義變量next,獲取id為next的箭頭
? ? ? ? ? ? var index = 1;//顯示第幾個(gè)按鈕,默認(rèn)顯示第一個(gè)按鈕
? ? ? ? ? ? function animate(offset){
? ? ? ? ? ? list.style.left=parseInt(list.style.left)+ offset +'px';
? ? ? ? ? ? }
? ? ? ? ? ? next.oclick=function (){
? ? ? ? ? ? animate(-600);
? ? ? ? ? ? }//實(shí)現(xiàn)點(diǎn)擊右箭頭列表圖片向左移動600像素
? ? ? ? ? ?prev.onclick=function(){
? ? ? ? ? ? animate(600);
? ? ? ? ? ? }//實(shí)現(xiàn)點(diǎn)擊右箭頭列表圖片向右移動600像素
? ? ? ? ? } ?
? ? </script>
2017-07-02
源代碼下載在視屏右下角位置