js 自动执行方法

<script type="text/javascript">
  var count=0;
  function ClickImageSwap(id)
  {
   if(id==5)
    id=count;
   if(count==2)
    count=0;
   var tempImage=document.getElementById("TempImage");
   if(id==0)
   {
    tempImage.src="images/topt1.jpg";
   }
   else if(id==1)
   {
    tempImage.src="images/topt2.jpg";
   }
   else if(id==2)
   {
    tempImage.src="images/topt3.jpg";
   }
   count++;
   setTimeout("ClickImageSwap(5)",3000);
  }
 </script>

 

<script type="text/javascript">
  var count=0;
  var b = true;
  function ImageSwap()
  {
   if(b)
   {
    if(count > 2)
    {
     count = 0;
    }
    else
    {
     count++;
    }
    ClickImageSwap(count);
    setTimeout("ImageSwap()",5000);
   }
  }
  
  function ClickImageSwap(id)
  {
   var tempImage=document.getElementById("TempImage");
   if(id==0)
   {
    tempImage.src="images/topt1.jpg";
   }
   else if(id==1)
   {
    tempImage.src="images/topt2.jpg";
   }
   else if(id==2)
   {
    tempImage.src="images/topt3.jpg";
   }
  }
  
  function Out(id)
  {
   b = true;
   count = id;
   ImageSwap();
  }
  
  function In(id)
  {
   b = false;
   ClickImageSwap(id);
  }
  
  ImageSwap();
  
 </script>

posted @ 2010-07-30 16:54  小さいです哥  阅读(450)  评论(0编辑  收藏  举报