<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"); 나 ; <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></head> <br><본문> <br><img id="img" alt="" src="images/1.jpg" width="200" height="200" /> <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></body> <br></html> <br> </div>