<div class="codetitle"> <span><a style="CURSOR: pointer" data="5653" class="copybut" id="copybut5653" onclick="doCopy('code5653')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code5653"> <br> <br> <br><title></title> <br><script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <br><script type="text/javascript"> <BR>var t; <BR>var speed = 2;//图片切换速度 <BR>var nowlan=0;//图片开始时间 <BR>function changepic() { <BR>var imglen = $("div[name='pic']").find("div").length; <BR>$("div[name='pic']").find("div").hide(); <BR>$("div[name='pic']").find("div").eq(nowlan).show(); <BR>nowlan = nowlan+1 ==imglen ?0:nowlan + 1; <BR>t = setTimeout("changepic()", speed * 1000); <BR>} <BR>onload = function () { changepic(); } <BR>$(document).ready(function () { <BR>//鼠标在图片上悬停让切换暂停 <BR>$("div[name='pic']").hover(function () { clearInterval(t); }); <BR>//鼠标离开图片切换继续 <BR>$("div[name='pic']").mouseleave(function () { changepic(); }); <BR>}); <BR></script> <br> <br> <br><div name="pic" style="float:left; position:relative;overflow:hidden;width:300px;height:240px;"> <br><div><img style="max-width:90%" style="max-width:90%" src="Chrysanthemum.jpg" alt="1"></div> <br><div><img style="max-width:90%" style="max-width:90%" src="Desert.jpg" alt="2"></div> <br><div><img style="max-width:90%" style="max-width:90%" src="Hydrangeas.jpg" alt="3"></div> <br> </div> <br> <br> <br> </div>