//循环显示图片----------------------------------------------------------------
<script language="JavaScript">
var NowFrame = 1; //定义当前图片
var MaxFrame = 3; //定义图片张数
function show() {
var next = NowFrame + 1;
if(next == MaxFrame+1)
{
NowFrame = MaxFrame;
next = 1;
}
{
document.getElementById('div'+next).style.display = "block";
document.getElementById('div'+NowFrame).style.display = "none";
if(NowFrame == MaxFrame)
NowFrame = 1; //当前图序列号最大时,设当前图序号为1,重新开始轮换显示
else
NowFrame++;
}
setTimeout('show()', 2000);
}
</script>
javascript随机显示图片
最新推荐文章于 2021-10-08 14:45:51 发布