?? fpage.asp
字號:
<%
'+++++++++++++++++++++++++++++++++++++
'◆模塊名稱: 公共翻頁模塊
'◆文 件 名: TurnPage.asp
'◆傳入參數: Rs_tmp (記錄集), PageSize (每頁顯示的記錄條數)
'◆輸 出: 記錄集翻頁顯示功能
'+++++++++++++++++++++++++++++++++++++
'
Sub TurnPage(ByRef Rs_tmp,PageSize) 'Rs_tmp 記錄集 PageSize 每頁顯示的記錄條數;
Dim TotalPage '總頁數
Dim PageNo '當前顯示的是第幾頁
Dim RecordCount '總記錄條數
Rs_tmp.PageSize = PageSize
RecordCount = Rs_tmp.RecordCount
TotalPage = INT(RecordCount / PageSize * -1)*-1
PageNo = Request.QueryString ("PageNo")
'直接輸入頁數跳轉;
If Request.Form("PageNo")<>"" Then PageNo = Request.Form("PageNo")
'如果沒有選擇第幾頁,則默認顯示第一頁;
If PageNo = "" then PageNo = 1
If RecordCount <> 0 then
Rs_tmp.AbsolutePage = PageNo
End If
'獲取當前文件名,使得每次翻頁都在當前頁面進行;
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
'取得當前的文件名稱,使翻頁的鏈接指向當前文件;
fileName = Mid(fileName,postion)
%>
<style type="text/css">
<!--
.style1 {color: #000000}
-->
</style>
<table width='598' height="46" border=0 align='center' cellpadding="0" cellspacing="0" bgcolor="#FDFDFD">
<tr>
<td width="155" align=center height="46"><span class="style1"> 總頁數:<%=TotalPage%>頁
當前第<%=PageNo%>頁</span></td>
<td width="330" align="right" height="46">
<span class="style1">
<%If RecordCount = 0 or TotalPage = 1 Then
Response.Write "首頁|前頁|后頁|末頁"
Else%>
<a href="<%=fileName%>?PageNo=1">首頁|</a>
<%If PageNo - 1 = 0 Then
Response.Write "前頁|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo-1%>">前頁|</a>
<%End If
If PageNo+1 > TotalPage Then
Response.Write "后頁|"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo+1%>">后頁|</a>
<%End If%>
<a href="<%=fileName%>?PageNo=<%=TotalPage%>">末頁</a>
<%End If%>
</span></td>
<td width="12" align="right" height="46"><span class="style1"></span> </td>
<td width=103 align="center" valign="bottom" height="46">
<form class="style1">轉到第
<%If TotalPage = 1 Then%>
<input type=text name=PageNo2 size=2 readonly disabled style="background:#d3d3d3" class="text復制">
<%Else%>
<input type=text name=PageNo size=2 value="" title=請輸入頁號,然后回車 class="text復制">
<%End If%>
頁 </form></td>
</tr>
</table>
<%End Sub%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -