js实现图片轮流切换

  • 格式:txt
  • 大小:1.27 KB
  • 文档页数:1
var MaxFrame = 6;//最大显示几张
function show() {
for ( var i = 1; i < (MaxFrame + 1); i++)
{
if (i == NowFrame)
document.getElementById('div' + NowFrame).style.display = ''; //当前图片显示
NowFrame++;
}
theTimer = setTimeout('show()', 1000); //设置定时器,显示下一张显示的图片
}
</SCRIPT>
</HEAD>
<BODY onLoad="show();">
<DIV style="position: absolute; left: 200px; top: 60px;">
<img src="../image/1.jpg" style="display: none;" id="div1" border="0">
<img src="../image/ad-01.jpg" style="display: none;" id="div4" border="0">
else
document.getElementById('div' + i).style.display = 'none'; //其他的图片隐藏
}
{
if (NowFrame == MaxFrame) //定义下一张显示的图片
NowFrame = 1;
else
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>轮换横幅广告</TITLE>
<SCRIPT language="JavaScript">
var NowFrame = 1;//初始化显示第几张
<img src="../image/ad-03.jpg" style="display: none;" id="div5" border="0">
<img src="../image/ad-04.jpg" style="display: none;" id="div6" border="0">
</DIV>
</BODY>
</HTML>
<img src="../image/2.gif" style="display: none;" id="div2" border="0">
<img src="../image/ad-02.jpg" style="display: none;" id="div3" border="0">

下载文档原格式

  / 1