js实现变换图片flash

以下是js代码,我测试了,还不错

  
  
  
  
  1. <div id="divs">  
  2. <img src="images/flash1.jpg" id="1" style="FILTER: revealTrans(duration=1,transition=16); cursor:pointer;" onclick="location.href = '#'">  
  3. <img src="images/flash2.jpg" id="2"   style="FILTER: revealTrans(duration=1,transition=17); cursor:pointer;display:none" onclick="location.href = '#'">  
  4. <img src="images/flash3.jpg" id="3"   style="FILTER: revealTrans(duration=1,transition=18); cursor:pointer;display:none" onclick="location.href = '#'">  
  5. <img src="images/flash4.jpg" id="4"   style="FILTER: revealTrans(duration=1,transition=19); cursor:pointer;display:none" onclick="location.href = '#'">  
  6. <img src="images/flash5.jpg" id="5"   style="FILTER: revealTrans(duration=1,transition=20); cursor:pointer;display:none" onclick="location.href = '#'">  
  7. <img src="images/flash6.jpg" id="6"   style="FILTER: revealTrans(duration=1,transition=21); cursor:pointer;display:none" onclick="location.href = '#'">  
  8. </div>  
  9.  
  10. <script language="javascript">  
  11. function $(_sId) {  
  12.     return document.getElementById(_sId);  
  13. }  
  14. var speed=5000;  
  15. var setid=null;   
  16. var auto="true";  
  17. function galleryplay(divs,a,mtime){ //t为要应用此函数的id,a初始化时显示的项目的顺序数   
  18.     if(divs=="0")return false;      
  19.     var start=3;  
  20.     if(auto=="true")  
  21.     {  
  22.         start = a-1;//初始项目   
  23.         speed = mtime;//切换间隔   
  24.         setid = null;//定时器       
  25.         var loop = function(){ //自动切换           
  26.             ids = divs.split(",");                          
  27.             for (var i=0;i<ids.length; i++)  
  28.             {              
  29.                  $(ids[i]).style.display='none';  
  30.               
  31.             }                                      
  32.             $(ids[start]).filters.revealTrans.Transition = Math.floor(Math.random() * 23);  
  33.             $(ids[start]).filters.revealTrans.apply();  
  34.             $(ids[start]).filters.revealTrans.play();  
  35.             $(ids[start]).style.display='';  
  36.               
  37.             setid=setTimeout(loop,speed);   
  38.             start++;   
  39.             if(start==ids.length){   
  40.                 start=0;                    
  41.             }   
  42.         };loop();       
  43.     }  
  44. }  
  45. galleryplay('1,2,3,4,5,6',1,5000);  
  46. </script>  

 

你可能感兴趣的:(职场,Flash,休闲,变换图片)