瘋狂

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

          html標(biāo)題滾動(dòng)例子

          Posted on 2010-11-22 09:37 瘋狂 閱讀(3631) 評(píng)論(3)  編輯  收藏 所屬分類(lèi): 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);
                      }

                 }

              
          }

          調(diào)用:
          var sc = new titleScroll("這是要滾動(dòng)的內(nèi)容",2);//參數(shù)1: 要滾動(dòng)的內(nèi)容,參數(shù)2:滾動(dòng)的次數(shù)
          c.loopTheScroll();
          例子下載
          /Files/freeman1984/sc.rar

          評(píng)論

          # re: html標(biāo)題滾動(dòng)例子  回復(fù)  更多評(píng)論   

          2010-11-24 16:05 by Beautyleg
          下來(lái)看看 呵呵

          # re: html標(biāo)題滾動(dòng)例子  回復(fù)  更多評(píng)論   

          2012-11-28 17:13 by 咸寧裝修網(wǎng)
          re: html標(biāo)題滾動(dòng)例子

          # re: html標(biāo)題滾動(dòng)例子  回復(fù)  更多評(píng)論   

          2013-03-31 13:45 by 坑貨
          不錯(cuò)謝謝了幫我解決了一個(gè)大難題
          主站蜘蛛池模板: 大埔区| 镇远县| 察雅县| 安龙县| 沧州市| 民县| 阳城县| 丰宁| 淮北市| 财经| 牙克石市| 宁乡县| 怀集县| 济阳县| 婺源县| 象山县| 黑龙江省| 阳城县| 兖州市| 郓城县| 贵南县| 江陵县| 双辽市| 措美县| 怀集县| 龙里县| 化德县| 连州市| 牙克石市| 嵊泗县| 射洪县| 乐清市| 内乡县| 灵武市| 香港 | 灌阳县| 宜宾市| 张掖市| 海淀区| 东乡县| 凌云县|