<!--用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="http://liyangbit.blogchina.com/catalog_2005.html#category1" target="_blank"><img class="myimg" alt="查看更多情感绿洲的文章,请点击此处" src="http://bimzcy.blogchina.com/inc/go.gif" /></a>※情感绿洲 </div><div class="divtext" id="mcategory1" target="_blank"></div></div><!--结束-->
<div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="http://liyangbit.blogchina.com/catalog_2005.html#category2" target="_blank"><img class="myimg" alt="查看更多文学草坪的文章,请点击此处" src="http://bimzcy.blogchina.com/inc/go.gif" /></a>※文学草坪</div><!--文学部分--><div class="divtext" id="mcategory2" target="_blank"></div></div><!--结束-->
<div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="http://liyangbit.blogchina.com/catalog_2005.html#category3" target="_blank"><img class="myimg" alt="查看更多科教园地的文章,请点击此处" src="http://bimzcy.blogchina.com/inc/go.gif" /></a>※科教园地</div><div class="divtext" id="mcategory3" target="_blank"></div></div><!--结束-->
<div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="http://liyangbit.blogchina.com/catalog_2005.html#category4" target="_blank"><img class="myimg" alt="查看更多电脑网络的文章,请点击此处" src="http://bimzcy.blogchina.com/inc/go.gif" /></a>※电脑网络</div><div class="divtext" id="mcategory4" target="_blank"></div></div><!--结束-->
<div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="http://liyangbit.blogchina.com/catalog_2005.html#category5" target="_blank"><img class="myimg" alt="查看更多院校文化,请点击此处" src="http://bimzcy.blogchina.com/inc/go.gif" /></a>※院校文化</div><div class="divtext" id="mcategory5" target="_blank"></div></div><!--结束-->
<div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="http://liyangbit.blogchina.com/catalog_2005.html#category6" target="_blank"><img class="myimg" alt="查看更多都市生活,请点击此处" src="http://bimzcy.blogchina.com/inc/go.gif" /></a>※都市生活</div><div class="divtext" id="mcategory6" target="_blank"></div></div><!--结束-->
<div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="http://liyangbit.bokee.com/catalog_2005.html#category7"target="_blank"><img class="myimg" alt="查看更多影音娱乐的文章,请点击此处" src="http://bimzcy.blogchina.com/inc/go.gif" /></a>※影音娱乐</div><!--音乐时空部分--><div class="divtext" id="mcategory7" target="_blank"></div></div><!--结束-->
<div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="http://liyangbit.bokee.com/catalog_2005.html#category8" target="_blank"><img class="myimg" alt="查看更多人在北京,请点击此处" src="http://bimzcy.blogchina.com/inc/go.gif" /></a>※人在北京</div><div class="divtext" id="mcategory8" target="_blank"></div></div><!--结束-->
</div></p>