图片轮播
window.setInterval("Huan()",4000);
var n = document.getElementsByClassName('ysd1').length-1;
var d =0;
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";
}
带箭头的轮播
var sy = 0;
var zd = document.getElementsByClassName('yz1').length-1;
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";
}
function aaaa()
{
if(sy>1)
{
sy=sy-1;
}
else
{
sy = zd;
}
Huan();
}
function bbbb()
{
if(sy<zd)
{
sy=sy+1;
}
else
{
sy=0;
}
Huan();
}