如何通過按鈕控制的圖片上下翻滾效果(2)_動易Cms教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      //和
      //<div class="NUM1" id="led3">3</div> …… (以此類推)
      //另外還要在CSS中添加 .f3…… #led3……的相關(guān)定義

      var direction = "down";
      var mainobj = document.all("mainpic");

      function scrolldown(f){
      if (mainobj.scrollTop>=frameheight*(f-1)){
      clearInterval(inter);
      mainobj.scrollTop=frameheight*(f-1);
      scrolling=0;
      }
      else{mainobj.scrollTop =speed;}
      }

      function scrollup(f){
      if (mainobj.scrollTop<=frameheight*(f-1)){
      clearInterval(inter1);
      mainobj.scrollTop=frameheight*(f-1);
      scrolling=0;
      }
      else{
      mainobj.scrollTop-=speed;
      }
      }

      function slidedown(){
      if (scrolling==0){
      scrolling=1;
      currentF ;
      obj=eval("document.all('f" currentF "')");
      obj.style.display="block";

      inter=eval("setInterval('scrolldown(" currentF ")',5)");
      if (currentF == total){
      direction = "up";
      }

      document.all("upbtn").style.display="";
      if (currentF==total){
      document.all("downbtn").style.display="none";
      }
      for (i=1;i<=total;i ){
      eval("document.all('led" i "').className='NUM1'");
      }
      eval("document.all('led" currentF "').className='NUM2'");
      }
      }

      function slideup(){
      if (scrolling==0){
      scrolling=1;
      currentF--;
      obj=eval("document.all('f" currentF "')");
      obj.style.display="block";

      inter1=eval("setInterval('scrollup(" currentF ")',5)");
      if (currentF == 1){
      direction = "down";
      }


      document.all("downbtn").style.display="";
      if (currentF==1){
      document.all("upbtn").style.display="none";
      }
      for (i=1;i<=total;i ){
      eval("document.all('led" i "').className='NUM1'");
      }
      eval("document.all('led" currentF "').className='NUM2'");
      }
      }

      //auto slide
      var interval01;
      var autotime = 4000;
      function autoslide(){
      if(direction == "down"){
      if (currentF == total-1){
      direction = "up";
      }
      slidedown();
      //alert(currentF);
      }
      else if(direction == "up"){
      if (currentF == 2){
      direction = "down";
      }
      slideup();
      //alert(currentF);
      }

      }
      function iniautoslide(){
      interval01 = setInterval("autoslide()",autotime);
      }
      iniautoslide();
      </script>

      查看更多 動易Cms教程  動易Cms模板

      共2頁上一頁12下一頁
      來源:模板無憂//所屬分類:動易Cms教程/更新時間:2006-05-22
      相關(guān)動易Cms教程