<div class="codetitle"> <span><a style="CURSOR: pointer" data="15874" class="copybut" id="copybut15874" onclick="doCopy('code15874')"><u>复制代</u></a></span>代码如下:</div> <div class="codebody" id="code15874"> <br> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br><html xmlns="http://www.w3.org/ 1999/xhtml"><br><head><br> <title></title><br> <style type="text/css"><br> img<br> {<br> 幅:200px; height:200px;<br> }<br> </style><br> <script src="jquery-1.9.1.js" type="text/javascript"></script><br> <script type="text/javascript"><br> $(function () {<br> $('#btn1').click(function () {<br> var num = Math.floor(Math.ランダム() * 8 1);<br> $('img').attr('src','picture/' num '.jpg')<br> })<br> })<br> </ script><br></head><br><body><br><img src="picture/1.jpg" id="img1" /><br><input id="btn1 " type="button" value="变换" /><br></body><br></html><br> </div>