<!--用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>