複製代碼 代碼如下: -/html/PUBL "IC DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> auto play <BR> //陣列的第一項為時長,其他項可自訂<BR> data = [["3","a"],["2","b"],["3","c"],["2","d"],[ "1",""]]; <br><br> $(document).ready(function(){ <BR> //設定觸發事件<BR> //設定觸發事件<BR> > back(obj,num); <BR> }; <BR> ){ <BR> $("#div_show") .html(obj[num][1]); <br> } <br><BR> function autoPlay(){ <BR> autoPlay.num = 0; <br> //初始化時間點<br> if(autoPlay.timepoint ==undefined) <> if(autoPlay.num <數據。 //依照元素時間長度播放陣列<BR> if(new Date().getTime()>autoPlay.timepoint){ <BR> if(autoPlay.first==undefined) <BR> autoPlay.first = truetrue; <BR> else <BR> //設定下次播放的時間點<BR> autoPlay.timepoint = (data[autoPlay.num][0]*1000) < } > setTimeout("autoPlay()",500); <BR> } <BR> var defaults = {inteval:500}; <BR> }}); <BR><BR> 定義播放時間,可以定義事件