log_Content "自己常用的ASP分页代码,将以下代码放入你的函数文件内,在使用的文件内写上<!--#include file="调用文件.asp" />,可以直接拿来用的! 在需要调用的位置放上以下语句 程序代码 <%call pageList(总页数,每页行数,当前页,当前页URL,是否显示分页信息)%> 程序代码 function pageList(allNum,pagesize,page,pageUrl,showall) dim temppage,tempvalue if Isnumeric(allNum) then if int(allNum)<1 then allNum=1 end if else allNum=1 end if if Isnumeric(pagesize) then if int(pagesize)<1 then pagesize=10 end if else pagesize=10 end if if Isnumeric(page) then if int(page)<1 then page=1 end if else page=1 end if allNum = int(allNum) pagesize = int(pagesize) page = int(page) temppage=fix(allNum/pagesize) if allNum mod pagesize > 0 then temppage = temppage + 1 end if if page>temppage then page=temppage end if if pageUrl="" then pageUrl=Request.ServerVariables("SCRIPT_Name") end if if instr(pageUrl,"?") = 0 then pageUrl = pageUrl & "?" end if if Right(pageUrl,1) = "?" then pageUrl = pageUrl else pageUrl = pageUrl&"&" end if if page > 10 then tempvalue = tempvalue & "<a href="""&pageUrl&"page=1"" title=""第一页""><span style=""font-family:webdings"">9</span></a> " end if if page > 1 then tempvalue = tempvalue & "<a href="""&pageUrl&"page="&(page-1)&""" title=""上一页""><span style=""font-family:webdings"">3</span></a> " end if for i=1 to 10 if page-5+i>=1 and page-5+i<=temppage then if page = page-5+i then tempvalue = tempvalue & page-5+i else tempvalue = tempvalue & "[<a href="""&pageUrl&"page="&page-5+i&""">" tempvalue = tempvalue & page-5+i tempvalue = tempvalue & "</a>]" end if tempvalue = tempvalue & " " end if next if page < temppage then tempvalue = tempvalue & "<a href="""&pageUrl&"page="&(page+1)&""" title=""下一页""><span style=""font-family:webdings"">4</span></a> " end if if page < temppage-10 then tempvalue = tempvalue & "<a href="""&pageUrl&"page="&temppage&"""><span style=""font-family:webdings"" title=""最后页"">:</span></a> " end if if showall = "all" or showall = true then tempvalue = tempvalue & "页次:"&page&"/"&temppage&"页共"&allNum&"条记录 "&pagesize&"条/页" end if pageList = tempvalue end function