圖片輪播的幾個小程序

圖片輪播spa

window.setInterval("Huan()",4000);圖片

var n = document.getElementsByClassName('ysd1').length-1;
var d =0;get

function Huan()
{

var attr = document.getElementsByClassName('ysd1');
d++;
if(d>n)
{
d = 0;
}
for(var i=0;i<=n;i++)
{
attr[i].style.display = "none";
}

attr[d].style.display = "block";
}io

帶箭頭的輪播function

var sy = 0;
var zd = document.getElementsByClassName('yz1').length-1;di

function Huan()
{
var attr = document.getElementsByClassName('yz1');

for(var i=0;i<attr.length;i++)
{
attr[i].style.display="none";
}
attr[sy].style.display = "block";
}display

function aaaa()
{
if(sy>1)
{
sy=sy-1;
}
else
{
sy = zd;
}

Huan();
}block

function bbbb()
{
if(sy<zd)
{
sy=sy+1;
}
else
{
sy=0;
}
Huan();
}document

相關文章
相關標籤/搜索