一直有很多人在问将归档日志改成下拉列表样式,我的是改了,可是没改好,现在月份都看不到呵,这是悬翎记的作品, 我转过来再让大家分享吧!

觉得俺Blog右侧的日志归档(Archives)列表太长,十分不爽,就索性将它改成了下拉菜单的形式。

修改方法:打开common目录下的cache.asp,将以下代码:

if action<>2 then
         Dim archive_item_Len,Month_array
         if ubound(blog_archive,1)=0 then archive="":exit function
         Month_array=Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月")
         archive_item_Len=ubound(blog_archive,2)
   For i=0 to archive_item_Len
             archive=archive&"<a class=""sideA"" href=""default.asp?log_Year="&blog_archive(1,i)&"&amp;log_Month="&blog_archive(2,i)&""" title=""查看当前日期的日志"">"&blog_archive(1,i)&"年"&Month_array(blog_archive(2,i)-1)&" ["&blog_archive(0,i)&"]</a>"
   Next
 end if

替换成:

 if action<>2 then
         Dim archive_item_Len,Month_array
         if ubound(blog_archive,1)=0 then archive="":exit function
         Month_array=Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月")
         archive_item_Len=ubound(blog_archive,2)
   archive=archive&"<select onchange=""window.location=this.options[this.selectedIndex].value;""><option value=""http://www.5dlog.com/"">Blog Archives</option>"
   For i=0 to archive_item_Len
             archive=archive&"<option value=""default.asp?log_Year="&blog_archive(1,i)&"&amp;log_Month="&blog_archive(2,i)&""" title=""查看此月份的日志"">"&blog_archive(1,i)&"年"&Month_array(blog_archive(2,i)-1)&" ["&blog_archive(0,i)&"]</option>"
   Next
   archive=archive&"</select>"
 end if

本文链接:将PJBlog2的存档列表改为下拉菜单形式

转载声明:本站文章若无特别说明,皆为原创,转载请注明来源:SHAMAS,谢谢!^^


随机文章