'***********************************************
'永法修改版
'函数名:SetPage;PrintPage
'作 用:分页函数
'应用:
'rs.open之后写上setpage(rs,pagecount,20)
'For循环里记得写上
'<%
'rs.movenext
'if i>rs.PageSize then exit for
'next
'%>
'循环完后表格外写上:PrintPage(PageCount,rs,URL)
'***********************************************
Sub SetPage(rs,PageCount,PageSize)
IF not rs.eof Then
IF not isempty(Request("page")) Then
IF IsNumeric(Request("page")) = True Then
PageCount=cint(Request("page"))
Else
PageCount=1
End IF
Else
PageCount=1
End IF
IF session("PageSize")="" or not IsNumeric(session("PageSize")) Then
session("PageSize") = PageSize
End IF
rs.pagesize=session("PageSize")
IF PageCount>rs.PageCount or PageCount<=0 Then
PageCount=1
End IF
IF not rs.eof Then rs.AbsolutePage=PageCount
End IF
End Sub
Sub PrintPage(pagecount, rs, URL)
IF rs.pagecount > 0 Then
str=pagecount&"/"&rs.pagecount&" "
i=1
Do While i<rs.pagecount+1
IF i<> pagecount Then
str=str&"<A href="&URL&"&page="&i&">"&i&"</A> "
else
str=str&"<font color=red>"&i&"</font> "
End IF
i=i+1
Loop
End IF
response.Write str
End Sub