JQuery画像の入れ替え効果


<script type="text/javascript">	
	$(document).ready(function(){	
		$(".clickButton a").attr("href","javascript:return false;");
		$(".clickButton a").each(function(index){			
			$(this).click(function(){
				changeImage(this,index);	
			});			
		});	
		autoChangeImage();		
	});

	function autoChangeImage(){
		for(var i = 0; i<=10000;i++){
			window.setTimeout("clickButton("+(i%'<%=countTpsc%>'+1)+")",i*2000); 			
		}
	}

	function clickButton(index){
		$(".clickButton a:nth-child("+index+")").click();
	}

	function changeImage(element,index){ 
	    var mms = '<%=tpdzs%>';
	    var arryImgs = mms.split(":");//<%=tpdzs%>              ,   “:”  		
		$(".clickButton a").removeClass("active");
		$(element).addClass("active");
		$(".imgs img").attr("src",'<%=basePath%>'+arryImgs[index]);
	}
</script>

----------------------------   HTML    

<div class="imgsBox">
	<div class="imgs">
		<img id="pic" src="<%=((Tpsc)tpscList_.get(0)).getTpdz() %>" width="282" height="164" />//          ,     	
	</div>
	<div class="clickButton" style="display: none">  //             ,     
	<div>
	<%
		for(int i = 0 ; i < tpscList_.size() ; i ++)
	{
	 %>
	<a class="" href=""><%=i+1 %></a>
	<%} %>
	</div>
	</div>
	</div>
<%=countTpsc%>とは、ピクチャが入れ替わる枚数を意味する
効果を表示http://www.eduji.com/myhome/logout-index.jsp右の画像の入れ替え効果