瘋狂

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

          html標題滾動例子

          Posted on 2010-11-22 09:37 瘋狂 閱讀(3631) 評論(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 坑貨
          不錯謝謝了幫我解決了一個大難題
          主站蜘蛛池模板: 锡林郭勒盟| 禹州市| 大悟县| 辽源市| 陆河县| 六盘水市| 武邑县| 蓬莱市| 莆田市| 东城区| 离岛区| 遵义市| 临沂市| 锡林浩特市| 红桥区| 重庆市| 汶川县| 新巴尔虎右旗| 丰台区| 章丘市| 蓝田县| 富裕县| 东平县| 凤翔县| 五台县| 如皋市| 新田县| 临澧县| 会宁县| 唐山市| 正蓝旗| 阜城县| 乌拉特后旗| 九台市| 稷山县| 大荔县| 苍梧县| 呼伦贝尔市| 密云县| 贵州省| 德化县|