由DOZB原创的首页自动更新代码对分栏式博客起到了极大的推动作用,可以说没有他的代码设计,分栏式博客也不会这么倍受大家喜爱与推崇!
前二天他又推出了跨年度自动更新代码。原创地址:http://dozb.blogchina.com/3736858.html
针对我的博客特点,我对代码结构进行了优化,现将针对我的博客改进后跨年度首页自动更新代码发布如下,供广大博友参考!
<DIV class=menu style="Z-INDEX: 9">
<A class=myokmenu style="BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px" href="catalog_2005.html">总目录
<TABLE><TBODY><TR><TD>
<A class=submenu href="catalog_2006.html">2006年</A>
<A class=submenu href="catalog_2005.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429012.html">心情故事
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080138.html">2006年</A>
<A class=submenu href="3429012.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429054.html">精品文萃
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080160.html">2006年</A>
<A class=submenu href="3429054.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429072.html">音乐时空
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080219.html">2006年</A>
<A class=submenu href="3429072.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429085.html">动画剧场
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080202.html">2006年</A>
<A class=submenu href="3429085.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429140.html">唯美贴图
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080183.html">2006年</A>
<A class=submenu href="3429140.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429178.html">在线游戏
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080268.html">2006年</A>
<A class=submenu href="3429178.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429184.html">QQ表情
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080300.html">2006年</A>
<A class=submenu href="3429184.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu style="CURSOR: hand" onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://myok.bokee.com');" alt="设为
首页">设为首页</A>
<A class=myokmenu style="WIDTH: 74px; CURSOR: hand" onclick="window.external.addFavorite('http://myok.bokee.com','山水天下')" alt="加入收藏">加入收藏</A>
</DIV>
<DIV class=menu style="MARGIN-TOP: 23px"><A class=myokmenu style="BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px"
href="3429099.html">网页学堂
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080273.html">2006年</A>
<A class=submenu href="3429099.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429115.html">电脑应用
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080245.html">2006年</A>
<A class=submenu href="3429115.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429122.html">开心乐园
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080229.html">2006年</A>
<A class=submenu href="3429122.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429130.html">生活百科
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080278.html">2006年</A>
<A class=submenu href="3429130.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="3429165.html">网页素材
<TABLE><TBODY><TR><TD>
<A class=submenu href="4080256.html">2006年</A>
<A class=submenu href="3429165.html">2005年</A>
</TD></TR></TBODY></TABLE></A>
<A class=myokmenu href="http://myroom.getbbs.com/">本站论坛</A>
<A class=myokmenu href="http://www.c168.com/ly9/guestbook.asp?user=myroom">我要留言</A>
<A class=myokmenu href="1565188.html">友情链接</A>
<A class=myokmenu href="3241761.html">申请链接</A>
<A class=myokmenu style="WIDTH: 74px; text: _blank" href="http://publishblog.bokee.com/control/main.b" target=_blank>用户登录
<TABLE><TBODY><TR><TD>
<A class=submenu href="http://publishblog.blogchina.com/control/main.b">博客登录</A>
<A class=submenu href="http://bbs.bokee.com/">博客论坛</A>
<A class=submenu href="http://photo.bokee.com/">图片博客</A>
<A class=submenu href="http://freecity.bokee.com/channel/index.htm">梦之城</A>
</TD></TR></TBODY></TABLE></A>
</DIV>
<!----首页自动更新---->
<DIV>
<SCRIPT>
var startYear = 2005;
var showCount = 12;
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;" ></iframe>');
}
</SCRIPT>
<SCRIPT>
function showcatalog(mycategoryname,categoryname)
{
var currShowCount = 0;
var currTotalCount = 0;
myok="";
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-currShowCount) break;
oA = oLI[i].children(1);
s = oA.innerHTML;
myok += "<li class=myli><a href='"+oA.href+"'>"+s+"</a></li>\r\n";
}
currShowCount += i;
currTotalCount += oLI.length;
}
for(;currShowCount<showCount;currShowCount++)
myok += "<li class=myli>...</li>\r\n";
currCategory.insertAdjacentHTML("beforeend",myok);
titleDIV = currCategory.parentElement.children(0);
titleDIV.insertAdjacentHTML("beforeend","("+ currTotalCount +")");
}
function showallcatalog()
{
showcatalog("mcategory1","category1");//心情故事
showcatalog("mcategory2","category2");//精品文萃
showcatalog("mcategory3","category5");//音乐时空
showcatalog("mcategory4","category4");//动画天地
showcatalog("mcategory5","category10");//网页学堂
showcatalog("mcategory6","category7");//电脑应用
showcatalog("mcategory7","category6");//开心乐园
showcatalog("mcategory8","category11");//生活百科
showcatalog("mcategory9","category3");//唯美贴图
}
</SCRIPT>
<!---------读入提取内容-----------><BODY onload=showallcatalog()>
<!---------日志排版样式----------->
<DIV>
<DIV class=mydiv1>
<DIV class=mybg><A href="catalog_2006.html#category1"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※心情故事</DIV>
<UL id=mcategory1></UL></DIV><!--结束-->
<DIV class=mydiv2>
<DIV class=mybg><A href="catalog_2006.html#category2"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※精品文萃</DIV>
<UL id=mcategory2></UL></DIV></DIV><!--结束-->
<DIV>
<DIV class=mydiv3>
<DIV class=mybg><A href="catalog_2006.html#category5"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※音乐时空</DIV>
<UL id=mcategory3></UL></DIV><!--结束-->
<DIV class=mydiv4>
<DIV class=mybg><A href="catalog_2006.html#category4"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※动画天地</DIV>
<UL id=mcategory4></UL></DIV></DIV><!--结束-->
<DIV>
<DIV class=mydiv5>
<DIV class=mybg><A href="catalog_2006.html#category10"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※网页学堂</DIV>
<UL id=mcategory5></UL></DIV><!--结束-->
<DIV class=mydiv6>
<DIV class=mybg><A href="catalog_2006.html#category7"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※电脑应用</DIV>
<UL id=mcategory6></UL></DIV></DIV><!--结束-->
<DIV>
<DIV class=mydiv7>
<DIV class=mybg><A href="catalog_2006.html#category6"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※开心乐园</DIV>
<UL id=mcategory7></UL></DIV><!--结束-->
<DIV class=mydiv8>
<DIV class=mybg><A href="catalog_2006.html#category11"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※生活百科</DIV>
<UL id=mcategory8></UL></DIV></DIV><!--结束-->
<DIV>
<DIV class=mydiv9>
<DIV class=mybg><A href="catalog_2006.html#category3"><IMG class=myimg alt=点击查看更多内容 src="./inc/go.gif"></A>※唯美贴图</DIV>
<UL id=mcategory9></UL></DIV><!--结束-->
<DIV class=mydiv0>
<DIV class=mybg0>※实用工具</DIV>
<DIV class=myul>
<UL>
<LI class=myli0><A href="3214358.html"><FONT color=red>博友问答专贴</FONT></A>
<LI class=myli0><A href="2735151.html">博友问答汇编</A>
<LI class=myli0><A href="1768049.html">博客实用帮助</A>
<LI class=myli0><A href="1856151.html">我的模板设计</A>
<LI class=myli0><A href="1856170.html">我的首页日志</A>
<LI class=myli0><A href="1633588.html">特效经典代码</A>
<LI class=myli0><A href="1567856.html">做Flash背景</A>
<LI class=myli0><A href="1599419.html">实用网址大全</A>
<LI class=myli0><A href="1939402.html">Flash万年历</A>
<LI class=myli0><A href="2392461.html">logo模板大全</A>
<LI class=myli0><A href="http://gonet.ys168.com/">绿色软件收藏</A>
<LI class=myli0><A href="2120788.html">瑞星杀毒升级</A></LI></UL></DIV>
<DIV class=myul>
<UL>
<LI class=myli0><A href="1884070.html">网页辅助工具</A>
<LI class=myli0><A href="2361994.html">素材汇总大全</A>
<LI class=myli0><A href="2394396.html">各类时钟大全</A>
<LI class=myli0><A href="1568354.html">Flash时钟集</A>
<LI class=myli0><A href="3294136.html">QQ表情集锦</A>
<LI class=myli0><A href="2081936.html">CSS鼠标代码</A>
<LI class=myli0><A href="2486756.html">在线音乐代码</A>
<LI class=myli0><A href="2225253.html">CSS做播放器</A>
<LI class=myli0><A href="3182591.html">CSS导航菜单</A>
<LI class=myli0><A href="3260962.html">博客索引美化</A>
<LI class=myli0><A href="1566491.html">加入背景音乐</A>
<LI class=myli0><A href="1565188.html" target=_blank>友情链接列表</A></LI></UL></DIV>
</DIV></DIV></div>
</body>
</html>
(来源:山水天下)
你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=4253245