国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 辦公 > Dreamweaver > 正文

用Dreamweaver和ASP實現分頁技術的參考

2024-09-12 12:31:46
字體:
來源:轉載
供稿:網友

  今天心情有點激動,想把"關于用DW ASP實現分頁技術的參考"分享給用DW ASP做網頁的朋友們.去掉只有"第一頁,前一頁,下一頁,最后一頁"的小痛苦

  此效果最后的顯示是:第N頁[共*頁] <<1 2 3 4 5 6 7 8 9 10 >>。

  用DW ASP做網頁時,在綁定記錄集后,代碼頁里馬上出現以下代碼:

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_數據庫名_STRING
Recordset1.Source = "SELECT * FROM 表名"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>

  現在我們要來對代碼做點修改,請在上面代碼中修改為如下的代碼:

<%
Dim I
Dim 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 數據庫名"
Recordset1.CursorType = 1 ’將上面代碼的0改為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=10 ’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
%>

  上面代碼中:RPP:指定每頁顯示的記錄條數。即每頁顯示幾條數據。

  NaviLength:顯示的數字鏈接個數,即10就為1 2 3 ...10的連接個數。

共3頁上一頁123下一頁
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 襄汾县| 金堂县| 洱源县| 开鲁县| 东宁县| 芦溪县| 东乌| 原阳县| 余姚市| 铜川市| 静海县| 金华市| 莱州市| 延川县| 若尔盖县| 莱阳市| 林西县| 太谷县| 喀喇沁旗| 顺义区| 镇安县| 建昌县| 车致| 无锡市| 高碑店市| 师宗县| 曲松县| 阳曲县| 东乌珠穆沁旗| 上蔡县| 留坝县| 斗六市| 旅游| 壤塘县| 洱源县| 德州市| 涞水县| 宣恩县| 合江县| 江川县| 临湘市|