當前位置:編程學習大全網 - 網站源碼 - html輪播代碼

html輪播代碼

<script>

window.onload?=?function(){?//頁面加載完成執行

var?images?=?document.getElementsByTagName('img');//取得所有img圖片

var?pos?=?0;//定義pos變量初始值=0

var?len?=?images.length;//取得圖片個數

setInterval(function(){//定每1秒時執行

images[pos].style.display?=?'none';//第壹個圖片隱藏,

pos?=?++pos?==?len0?:?pos;//pos在圖片個數範圍內遞增

images[pos].style.display?=?'inline';//下壹個圖片顯示

},1000);

};

</script>

  • 上一篇:源代碼vip
  • 下一篇:Kmplayerhdmi源代碼輸出
  • copyright 2024編程學習大全網