自己用的ASP分页函数
作者:Rock 来源:asp之家 时间:2009-10-18 11:30:00
函数名:FenYe(url,pageCount,recordCount,curPage,cssstyle)
功能:分页
参数:url当前页的网址;pageCount总页数;
recordCount;总记录数;curPage当前页数; cssstyle连接的样式表
示例:Call FenYe
("wangzhi.asp",rs.PageCount,rs.RecordCount,page,"class=''memu2''")
Sub FenYe(url,pageCount,recordCount,curPage,cssstyle)
if url="" then Exit Sub
if inStr(url,"?")<>0 then
if right(url,1)<>"?" then
url=url&"&"
end if
else
url=url&"?"
end if
if pagecount<=1 then exit sub
Response.Write "共"&recordCount &"条记录 " & curPage & "/" & pageCount & "页"
if curpage=1 then
Response.Write " [首 页] [上 页]"
else
Response.Write " <a "&cssstyle&" href=''"&url&"page=1''>[首 页]</a> <a "&cssstyle&" href=''"&url&"page="& curPage-1 &"''>[上 页]</a>"
end if
/>if Cint(curPage)=Cint(PageCount) then
Response.Write " [下 页] [尾 页]"
else
Response.Write " <a "&cssstyle&" href=''"&url&"page="& curPage+1 &"''>[下 页]</a> <a "&cssstyle&" href=''"&url&"page="& pageCount &"''>[尾 页]</a>"
end if
Response.Write " 跳转到 <select name=''select1'' size=''1'' onChange=''javascript:window.location.replace(this.options[this.selectedIndex].value)''>"
for i=1 to pageCount
Response.Write "<option"
If Cint(curPage) = i Then
Response.Write " selected "
End If
Response.Write " value=''"&url&"page="&i&"''>第" & i & "页</option>"
next
Response.Write "</select>"
End Sub