<%
SQL = ""
Set Rs = Server. CreateObject ("Adodb. RecordSet ")
Rs. open SQL, TXconn, 1, 1
If Rs. RecordCount Then
TopNum = 10' defines how many entries are displayed per page
QName = "Page" 'defines the variable name of the received Page number.
Page = Request. QueryString (QName)
If Page = "" Then
Page = 1
ElseIf Not IsNumeric (Page) Then
Page = 1
Else
Page = Page + 0
End if
MaxPage = Fix (Rs. RecordCount/TopNum)
If (Rs. RecordCount mod TopNum) Then MaxPage = MaxPage + 1
If Page> MaxPage Then Page = MaxPage
Rs. PageSize = TopNum
Rs. AbsolutePage = Page
For I = 1 to TopNum
If Rs. bof or Rs. eof Then Exit
Response. write (I & "<br/> ")
Rs. MoveNext
Next
Else
Response. write ("no data ")
End If
%>
<% = TXPage (Rs. RecordCount, TopNum, 2, 0, 0, QName) %>
<%
Function TXPage (Totals, PerNums, PageNum, Info, List, Input, QName)
'Pagination function (all quantity, number of records displayed on each Page, number of Page numbers, Page number statistics, drop-down list, input box, Page number variable name [blank for Page])
Dim strBegin, strBefore, strPrev, strNext, strAfter, strEnd, BeginNum, EndNum, Page, Pages, Url
StrBegin = "<font face =" "webdings" "> 9 </font>" 'defines the display style of the button on the first page.
StrBefore = "<font face =" "webdings"> 7 </font> "'defines the display style of buttons on several pages
StrPrev = "<font face =" "webdings" "> 3 </font>" 'defines the display style of buttons on the previous page.
StrNext = "<font face =" "webdings" "> 4 </font>" 'defines the display style of the next page button
StrAfter = "<font face =" "webdings" "> 8 </font>" 'defines the display style of the buttons on the last few pages.
StrEnd = "<font face =" "webdings" ">:</font>" 'defines the button display style on the last page.
PageNum = Fix (PageNum/2)
If QName = "" Then QName = "Page"
Page = Request. QueryString (QName)
Url = "? "
Dim Query, str, I
Query = Split (Request. ServerVariables ("QUERY_STRING "),"&")
For I = 0 to Ubound (Query)
Str = Split (Query (I), "= ")
If Lcase (Str (0) <> Lcase (QName) Then Url = Url & Str (0) & "=" & Str (1 )&"&"
Next
PerNums = PerNums + 0
If Totals mod PerNums Then
Pages = Fix (Totals/PerNums) + 1
Else
Pages = Fix (Totals/PerNums)
End If
If IsNumeric (Page) Then
Page = Page + 0
If Page> Pages Then
Page = Pages
ElseIf Page <1 Then
Page = 1
End If
Else
Page = 1
End If
TXPage = ""
BeginNum = Page-PageNum
EndNum = Page + PageNum
If BeginNum <1 Then BeginNum = 1
If EndNum-BeginNum <PageNum * 2 Then EndNum = BeginNum + PageNum * 2
If EndNum> Pages Then EndNum = Pages
If EndNum-BeginNum <PageNum * 2 Then BeginNum = EndNum-PageNum * 2
If BeginNum <1 Then BeginNum = 1
If BeginNum> PageNum * 2 and PageNum> 1 Then TXPage = TXPage & "<a href =" & Url & QName & "=" & Page-PageNum * 2 &"""
Title = "" "& PageNum * 2 &" Page ">" & strBefore & "</a>"
If BeginNum> 1 Then TXPage = "<a href =" & Url & QName & "= 1" "Title =" "First Page"> "& strBegin &" </a> "& TXPage &" <
Href = "" & Url & QName & "=" & Page-1 & "Title =" "previous Page"> "& strPrev &" </a> .."
For I = BeginNum to EndNum
If I = Page Then
TXPage = TXPage & "[<span style =" "cursor: pointer; font-weight: bold;" ">" & I & "</span>]"
Else
TXPage = TXPage & "[<a href =" & Url & QName & "=" & I & ""> "& I &" </a>]"
End If
Next
If EndNum <Pages Then TXPage = TXPage &".. <a href = "" & Url & QName & "=" & Page + 1 & "Title =" "next Page"> "& strNext &" </a>"
If EndNum <Pages-PageNum * 2 and PageNum> 1 Then TXPage = TXPage & "<a href =" & Url & QName & "=" & Page + PageNum * 2 & "Title = ""
"& PageNum * 2 &" Page ">" & strAfter & "</a>"
If EndNum <Pages Then TXPage = TXPage & "<a href =" & Url & QName & "=" & Pages & "" Title = "" Last Page "> "& strEnd &" </a>"
If Info Then TXPage = TXPage & "Page Times:" & Page & "/" & Pages & "Page total" & Totals & "items" & PerNums & "items/Page"
If List Then
TXPage = TXPage & "<select onChange =" "javascript: window. location. href = '" & Url & QName & "=' + this. options
[This. selectedIndex]. innerText; "">"
For I = 1 to Pages
TXPage = TXPage & "<option"
If I = Page Then TXPage = TXPage & "selected"
TXPage = TXPage & ">" & I & "</option>"
Next
TXPage = TXPage & "</select>"
End If
If Input Then TXPage = TXPage & "<input type =" "text" "size =" "1" "Title =" Enter the number and press enter ""
Style = "" overflow: visible; ime-mode: disabled; "" onkeydown = "" javascript: if
('. Metadata.'. indexOf ('.' + event. keyCode + '.')> = 0) {if
(Event. keyCode = 13) {window. location. href = '"& Url & QName &" =' + value ;}} else {return false;} "">"
End Function
%>