一個人的Java

          本人博客中國的分欄代碼,分享一下

          <!--用iframe來裝入2005索引頁,這樣我們就獲得了所有本年度的文章列表了-->
          <!--<iframe id="cataloghtml" src="catalog_2005.html" style=display:none;position:absolute;top:400;left:400;z-index:250

          ></iframe>-->
          <script>
          var startYear = 2005; //你的博客是哪一年建立的?
          var showCount = 10; // 每個欄目顯示多少條?


          var d = new Date();
          var currYear = d.getUTCFullYear();
          for(i=currYear;i>=startYear;i--)
          {
          document.writeln('<iframe id="cataloghtml'+i+'" src="catalog_'+i+'.html"

          style=display:none;position:absolute;top:400;left:400;z-index:250 ></iframe>');
          }
          </script>
          <script>
          //這部分的腳本是自動更新用的
          //從cataloghtml的categoryname這個欄目讀取文章列表放到當前頁面的mycategoryname中
          function showcatalog(mycategoryname,categoryname)
          {
          var currShowCount = 0;
          var currTotalCount = 0;
          l="<ul type='circle'>";
          for(iyear=currYear;iyear>=startYear;iyear--)
          {
          currCategory = document.body.all[mycategoryname];
          ol = eval("cataloghtml"+iyear+".document.body.all");

          var entityDiv = null;
          for(i=0;i<ol.length;i++)
          {
          if(ol[i].className =="entity")
          {
          entityDiv = ol[i];break;
          }
          }
          ol = entityDiv.children.tags("UL");
          var oLI=null;
          for(i=0;i<ol.length;i++)
          {
          if(ol[i].children(0).name==categoryname)
          {
          oLI = ol[i].children.tags("LI");
          break;
          }
          }
          if(oLI == null) return ;
          for(i=0;i<oLI.length;i++)
          {
          if(i>showCount-1) break;
          oA = oLI[i].children(1);
          s = oA.innerHTML;
          pos = s.search(/[)|】|』|\]]{1}/);
          if(pos>0)s=s.slice(pos+1);
          l += "<li style='width:245px;height:18;overflow:hidden'><a href='"+oA.href+"' target='_blank'>"+s+"</a></li>\r\n";
          }
          currShowCount += i;
          currTotalCount += oLI.length;
          }

          for(;currShowCount<showCount;currShowCount++)
          l += "<li style='width:245px;height:18;overflow:hidden'>...</li>\r\n";

          l+="</ul>";
          currCategory.insertAdjacentHTML("beforeend",l);
          // 增加代碼,統計欄目文章數
          titleDIV = currCategory.parentElement.children(0);
          titleDIV.insertAdjacentHTML("beforeend","("+ currTotalCount +")");
          }


          //從cataloghtml讀取目錄并生成當前頁面

            function showallcatalog()

            {

            //需要改寫的地方之一

            showcatalog("mcategory1","category1");//※情感綠洲

            showcatalog("mcategory2","category2");//※文學草坪

            showcatalog("mcategory3","category3");//※科教園地

            showcatalog("mcategory4","category4");//※電腦網絡
           
                  showcatalog("mcategory5","category5");//※院校文化

            showcatalog("mcategory6","category6");//※都市生活

            showcatalog("mcategory7","category7");//※影音娛樂

            showcatalog("mcategory8","category8");//※人在北京

            //……

            //注意,上面的省略號表示如果還有第九、第十個標題欄時依此類推,寫類似的代碼

            }

            </script>

          <!--當body裝入后調用showallcatalog()裝載最新文章列表-->

            <body onload=showallcatalog()>

            

              <div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="

              <div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="

              <div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="

              <div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="

              <div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="

             <div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="

             <div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href=" class="myimg" alt="查看更多影音娛樂的文章,請點擊此處" src="

             <div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="

             </div></p>

          posted on 2005-12-02 19:38 lemon 閱讀(595) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          My Links

          Blog Stats

          常用鏈接

          留言簿(5)

          隨筆檔案

          文章檔案

          收藏夾

          博客中國

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 句容市| 泗阳县| 平塘县| 绥芬河市| 灵寿县| 普洱| 伊吾县| 永善县| 岳阳县| 龙胜| 咸阳市| 武平县| 西吉县| 大新县| 布拖县| 巴楚县| 邵武市| 应城市| 罗田县| 曲麻莱县| 错那县| 威信县| 大冶市| 通海县| 喜德县| 新安县| 彭山县| 新化县| 商都县| 赤城县| 仁怀市| 色达县| 禹城市| 瑞安市| 怀安县| 海口市| 宜兰县| 东兰县| 普兰店市| 巫山县| 原平市|