陈凯歌起诉胡戈结果:谁能帮我完成这一段asp分页代码.

来源:百度文库 编辑:高校问答 时间:2024/04/29 23:40:57
<%if not rs.eof then
pages=3
rs.pageSize=pages
allPages=rs.pageCount
page=Request.QueryString("page")
if isEmpty(page) or Cint(page) <1 then
page=1
elseif Cint(page) > allPages then
page=allPages
end if
rs.AbsolutePage=page
Do while not rs.eof and pages >0 %>
<%=rs("名称")%>
<%pages=pages - 1
rs.MoveNext
Loop
else
Response.Write("数据库暂无内容!")
End if
rs.Close
Set rs=Nothing %>

大家帮我写完这一段的分页定义函数.

给你个现成的分页过程,

'----------------------------------------------------------
'分页过程
'创建公用分页过程
'参数:无
'----------------------------------------------------------
Function rsToPageHtml(rsPage,PageSize,rsUrl)
If rsPage.EOF Then
rsToPageHtml = "没有记录!"
Exit Function
End If
Dim rsCount,PageCount,Page,sScriptName,strTemp
Dim tmpPage, intPage, allPage
rsCount = rsPage.RecordCount
rsPage.PageSize = PageSize
PageCount = rsPage.PageCount
Page = Clng(Request("Page"))
'Page = Clng(Page)
if Page < 1 then Page = 1
If Page > Pagecount Then Page = Pagecount
rsPage.AbsolutePage = Page
sScriptName = Request.ServerVariables("SCRIPT_NAME")
if InstrRev(rsUrl,".asp?") > 0 then
rsUrl = rsUrl & "&Page="
else
rsUrl = rsUrl & "?Page="
end if
strTemp = ""
tmpPage = 10
intPage = Int((Page-1) / tmpPage)
allPage = Int(Pagecount / tmpPage)
If Page<>1 and intPage<>0 Then strTemp = strTemp &"<a href="""& rsUrl &"1"" title=首页><font face=webdings>9</font></a> "
If intPage>0 Then strTemp = strTemp &"<a href="""& rsUrl & ((intPage-1)*tmpPage+1) &""" title=前十页><font face=webdings>7</font></a> "
If intPage<allPage Then
For n=(intPage*tmpPage+1) To (intPage+1)*tmpPage
If n=Page Then
strTemp = strTemp &" <font color=red><b>"& n &"</b></font> "
Else
strTemp = strTemp &" <a href="""& rsUrl & n &"""><b>"& n &"</b></a> "
End If
Next
Else
For n=(intPage*tmpPage+1) To Pagecount
If n=Page Then
strTemp = strTemp &" <font color=red><b>"& n &"</b></font> "
Else
strTemp = strTemp &" <a href="""& rsUrl & n &"""><b>"& n &"</b></a> "
End If
Next
End If

If intPage<allPage Then strTemp = strTemp &"<a href="""& rsUrl & ((intPage+1)*tmpPage+1) &""" title=后十页><font face=webdings>8</font></a> "
If Page<>Pagecount and intPage<>allPage Then strTemp = strTemp &"<a href="""& rsUrl & Pagecount &""" title=末页><font face=webdings>:</font></a> "
strTemp = strTemp &"  共"& PageCount &"页 "&"共 "&rsCount&" 条记录"
rsToPageHtml = strTemp
End Function