document.getElementById(imgID).src = ".....";
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> <script type="text/javascript"> var i = 1; function showImg() { i++; document.getElementById("img1").src = "images/loading" + i + ".gif"; if(i >= 10) i = 1; } </script> </head> <body> <form id="form1" runat="server"> <div> <img id="img1" src="images/loading1.gif" onclick="showImg()" /> </div> </form> </body> </html>