学习参考:用Dreamweaver ASP实现网页分页(2)

2008-02-23 07:10:46来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折


</tr>
<%
Recordset1.MoveNext
If Recordset1.EOF OR Recordset1.BOF Then Exit For
Next
End If
%>
<tr bgcolor="#FFFFFF">
<td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="#006699" class="w12">
<td width="121" align="center"><% showPageInfo Recordset1.PageCount,PageNo %>
</td>
<td width="573" align="center">
<% showPageNavi Recordset1.PageCount,PageNo %>
</td>
</tr>
</table></td>
</tr>
</table>
这时你去点应用程序中的“服务器行为”中的记录集,在代码中就显示为一下代码,也是我的原代码:

<%
Dim I
Dim RPP’RPP:指定每页显示的记录条数,
Dim PageNo
I=1
RPP=50
PageNo=CInt(Request("PageNo"))
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_数据库名_STRING
Recordset1.Source = "SELECT * FROM 表名 ORDER BY 编号 ASC"
Recordset1.CursorType = 1
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
Recordset1.PageSize=RPP
If PageNo<=0 Then PageNo=1
If PageNo>Recordset1.PageCount Then PageNo=Recordset1.PageCount
Recordset1.AbsolutePage=PageNo
Sub ShowPageInfo(tPageCount,cPageNo)
Response.Write "第"&cPageNo&"页[共"&tPageCount&"页]"
End Sub
Sub ShowPageNavi(tPageCount,cPageNo)
If cPageNo<1 Then cPageNo=1
If tPageCount<1 Then tPageCount=1
If cPageNo>tPageCount Then cPageNo=tPageCount
Dim NaviLength
NaviLength=20 ’NaviLength:显示的数字链接个数
Dim I,StartPage,EndPage
StartPage=(cPageNo\NaviLength)*NaviLength 1
If (cPageNo Mod NaviLength)=0 Then StartPage=StartPage-NaviLength
EndPage=StartPage NaviLength-1
If EndPage>tPageCount Then EndPage=tPageCount
If StartPage>1 Then
Response.Write "<a class=""pageNavi"" href=""?PageNo=" & (cPageNo-NaviLength) & """><<</a> "
Else
Response.Write "<font color=""#CCCCCC""><<</font> "
End If
For I=StartPage To EndPage
If I=cPageNo Then
Response.Write "<b>"&I&"</b>"
Else
Response.Write "<a class=""pageNavi"" href=""?PageNo=" & I & """>" & I & "</a>"
End If
If I<>tPageCount Then Response.Write "&nbsp;"
Next
If EndPage<tPageCount Then
Response.Write " <a class=""pageNavi"" href=""?PageNo=" & (cPageNo NaviLength) & """>>></a>"
Else
Response.Write " <font color=""#CCCCCC"">>></font> "
End If
End Sub
%>   不过有一个缺点就是:如当你想找99页时点>>9次,要是有一个输入框,输入99后回车就到99就完美了。不知在DW ASP中再怎么修改一下就能达到呢?期待。
关键词:
【推荐给好友】【关闭】
最新五条评论
查看全部评论
评论总数 0 条
您的评论
用户名: 新注册) 密 码: 匿名:
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Dreamweaver中加入竖直线的问题

下一篇:在Dreamweaver中插入有颜色的直线