1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>Insert title here</title> 8 <script type="text/javascript" src=js/jquery-1.7.2.min.js></script> 9 <script type="text/javascript" src=js/jquery.easyui.min.js></script> 10 <script type="text/javascript"> 11 function reloadImage() { 12 document.getElementById('btn').disabled = ture; 13 document.getElementById('identity').src = 'rdentity.do?ts=' 14 + new Date().getTime(); 15 } 16 17 18 var curIndex=0; 19 //时间间隔(单位毫秒),每秒钟显示一张,数组共有5张图片放在Photos文件夹下。 20 var timeInterval=1000; 21 var arr=new Array(); 22 arr[0]="images/main1.png"; 23 arr[1]="images/main2.jpg"; 24 arr[2]="images/main3.jpg"; 25 26 setInterval(changeImg,timeInterval); 27 function changeImg() 28 { 29 var obj=document.getElementById("obj"); 30 if (curIndex==arr.length-1) 31 { 32 curIndex=0; 33 } 34 else 35 { 36 curIndex+=1; 37 } 38 obj.src=arr[curIndex]; 39 } 40 </script> 41 </head> 42 <body> 43 44 <img src="rdentity.do" id="identity" onload="btn.disabled=false;" /> 45 <input type="button" value="换个图片" onclick="reloadImage()" id="btn"> 46 47 48 49 <img id=obj src ="images/main1.png" width=200 height=150 border =0> 50 </body> 51 </html>