<div class="codetitle"> <span><a style="CURSOR: pointer" data="24717" class="copybut" id="copybut24717" onclick="doCopy('code24717')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code24717"> <br><script type="text/javascript"> <BR>var i = 1; var n; <BR>function showImg() { <BR>if (document.getElementById('img').getAttribute("src") == "images/1.jpg") { <BR>document.getElementById('img').setAttribute("src","images/2.jpg"); <BR>} <BR>else { <BR>document.getElementById('img').setAttribute("src","images/1.jpg"); <BR>} <BR>} <BR>function showImg1() { <BR>document.getElementById('img').setAttribute("src", "images/" + i + ".jpg"); i++; <BR>if (i > 10) <BR>{ <BR>i = 1; <BR>} <BR>} <BR>function show() { <BR>n=setInterval(showImg1, 500); <BR>} <BR>function show1() { <BR>clearInterval(n); <BR>} <BR></script> <br> <br> <br><img id="img" alt="" src="images/1.jpg" style="max-width:90%" style="max-width:90%"> <br><input id="Button1" type="button" value="换图片" onclick="showImg()"> <br><input id="Button2" type="button" value="切图" onclick="showImg1()"> <br><input id="Button3" type="button" value="轮换" onclick="show()"> <br><input id="Button4" type="button" value="停止轮换" onclick="show1()"> <br> <br> </div>