在动态页中上一页 下一页 首页和尾页的代码是啥
发布网友
发布时间:2022-04-29 19:00
我来回答
共2个回答
热心网友
时间:2022-06-20 03:55
分页显示代码:
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<%
Dim page_no '分页显示
If Request.QueryString("page_no")="" Then
page_no="1"
Else
page_no=CInt(Request.QueryString("page_no")) 'CInt函数表示将字符串转换为整数
End If
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Select * From guizhang order by add_time desc " , conn,3,3
y=0
if not rs.eof and not rs.bof then
rs.PageSize=20
dim page_total
page_total=rs.PageCount
rs.AbsolutePage=page_no
Dim I
I=20
y=0
Do While Not rs.Eof And I>0
I=I-1
y=y+1
%>
<tr>
<td height="20" ><%=y %>.<a href="gzdetail.asp?id=<%=rs("id")%>"><%=left(rs("title"),25)%></a> </td>
</tr>
<% rs.movenext
loop %>
<tr>
<td height="20" align="center">
<% Response.Write "<p>共有" & page_total & "页,"
Response.Write "当前显示第" & page_no & "页,"
Dim numPre,numNext
numPre=page_no-1
numNext=page_no+1
Response.Write "<a href='guizhang.asp?dd="&dd&"&_ser="&_ser&"&_type="&_type&"&page_no=1'>第一页</a>"
If numPre=0 Then
Response.Write " 上一页"
Else
Response.Write " <a href='guizhang.asp?dd="&dd&"&_ser="&_ser&"&_type="&_type&"&page_no=" & numPre & "'>上一页</a>"
End If
If numNext>page_total Then
Response.Write " 下一页"
Else
Response.Write " <a href='guizhang.asp?dd="&dd&"&_ser="&_ser&"&_type="&_type&"&page_no=" & numNext & "'>下一页</a>"
End If
Response.Write " <a href='guizhang.asp?dd="&dd&"&_ser="&_ser&"&_type="&_type&"&page_no=" & page_total & "'>最后页</a>"
%>
</td>
</tr>
<% else %>
<tr>
<td height="20" align="center"><br /><br/>还没有添加相应的规章制度 </td>
</tr>
<%
end if
rs.close
%>
</table>
热心网友
时间:2022-06-20 03:56
这里有一个代码,你自己慢慢看啊:
http://www.aspin.com/func/content-search?id=4333410&qry=page
若不行,则
http://www.aspin.com/func/search?tree=aspin&qry=page&cat=all&x=0&y=0