瘋狂

          STANDING ON THE SHOULDERS OF GIANTS
          posts - 481, comments - 486, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          html標題滾動例子

          Posted on 2010-11-22 09:37 瘋狂 閱讀(3637) 評論(3)  編輯  收藏 所屬分類: java web
          首先是:
          titlescroll.js文件
          function titleScroll(title_string,timestoloop){
              
                var index_count 
          = 0;
                var cmon;
              var kill_length 
          = 0;
              var times 
          = 0;
                 var title_string 
          = title_string;
                 var title_length 
          = title_string.length;
                 var timestoloop 
          = timestoloop;
                 
          this.scrollTheTitle = function(){
                     
                        var doc_title 
          = title_string.substring(index_count,title_length);
                    
                     document.title 
          = doc_title;    
                     index_count
          ++;
                     }
          ;
                 
                 
          this.loopTheScroll = function(){
                      var my 
          = this;
                        my.scrollTheTitle();
                          
          if(kill_length >= title_length)
                           
          {
                                   
          if(times+1<timestoloop){
                                       times
          ++;
                                       kill_length
          =0;
                                       index_count
          =0;
                                       cmon 
          = setTimeout(function(){my.loopTheScroll();},0)
                                   }
          else{
                                  clearTimeout(cmon);
                                }

                           }
          else{
                          
                          kill_length
          ++;
                      
          //    alert(kill_length);
                          
          //alert(times);
                          cmon = setTimeout(function(){my.loopTheScroll();},300);
                      }

                 }

              
          }

          調用:
          var sc = new titleScroll("這是要滾動的內容",2);//參數1: 要滾動的內容,參數2:滾動的次數
          c.loopTheScroll();
          例子下載
          /Files/freeman1984/sc.rar

          評論

          # re: html標題滾動例子  回復  更多評論   

          2010-11-24 16:05 by Beautyleg
          下來看看 呵呵

          # re: html標題滾動例子  回復  更多評論   

          2012-11-28 17:13 by 咸寧裝修網
          re: html標題滾動例子

          # re: html標題滾動例子  回復  更多評論   

          2013-03-31 13:45 by 坑貨
          不錯謝謝了幫我解決了一個大難題
          主站蜘蛛池模板: 东乌珠穆沁旗| 建宁县| 茂名市| 翁源县| 巫溪县| 花莲县| 醴陵市| 陇川县| 尼木县| 旬邑县| 大埔区| 图们市| 德安县| 常宁市| 龙岩市| 临沂市| 东乡县| 唐海县| 翼城县| 隆德县| 永城市| 昔阳县| 错那县| 蕉岭县| 漾濞| 麻江县| 安福县| 长武县| 南京市| 凤冈县| 浙江省| 新乡县| 河东区| 闽清县| 苍溪县| 筠连县| 金川县| 万山特区| 阿坝| 家居| 刚察县|