ASP article pagination Class

Source: Internet
Author: User
Tags prev

ASP article pagination Class

<%

Class Cls_page

'**************************************************
' Function name: showpage
' Function: Show pagination
' Parameters: as follows
' strFileName: The following file, such as xxx.asp?page=
' Xtotalnum: Total
' Xpagecount: Total pages
' Xmaxperpage: Display quantity per page
' Xcurrentpage: Current page
' Xpagename: Current page name
' Xunitname: Classification unit name, such as "article, section, amplitude"
' Xshowstyle: Style to display page pagination
' Return value: Paging
'**************************************************
Public Function ShowPage

(Strfilename,xtotalnum,xpagecount,xmaxperpage,xcurrentpage,xpagename,xunitna

Me,xshowstyle)
strURL = Clsmain.joinchar (strFileName)
Dim I,pagestr
If xtotalnum > 0 Then
If xpagecount >= 1 Then
Select Case Xshowstyle
Case "1" ' Pagination Style 1: List all

Page numbers with fewer page numbers to use
Pagestr = pagestr & "<div

Id= "" ShowPage "" > "
Pagestr = pagestr & "<a

class= "" Totalpage "" > All "&xPageName&":<b> "& Xtotalnum &" </b> "& Xunitname

& "</a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "PageInfo" "> Page:<b>" & Xcurrentpage & "/" & Xpagecount &

"</b></a>"
For I=1 to Xpagecount
If i = Xcurrentpage

Then
Pagestr =

Pagestr & "&nbsp; [<a class= "" CurrentPage "" ><font color= ' Red ' > "& I &

"</FONT></A>]"
Else
Pagestr =

Pagestr & "&nbsp; [<a href= "" & strURL & "Page=" & I & "" "

class= "" GoToPage "" > "& I &" </A>] "
End If
Next
Pagestr = Pagestr &

"</div>" &vbcrlf
Case "2" ' Pagination Style 2: Display home page

, Prev, Next, last, all symbols and go to the page's input box
Pagestr = pagestr & "<div

Id= "" ShowPage "" > "
Pagestr = pagestr & "<a

class= "" Totalpage "" > All "&xPageName&":<b> "& Xtotalnum &" </b> "& Xunitname

& "</a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "PageInfo" "> Page:<b>" & Xcurrentpage & "/" & Xpagecount &

"</b></a>"
If xcurrentpage > 1 Then
Pagestr = Pagestr &

"&nbsp;<a href=" "" & strURL & "page=1" "title=" "Home"

class= "" FirstPage "" >|&lsaquo;</a> "
Pagestr = Pagestr &

"&nbsp;<a href=" "" & strURL & "Page=" & XCurrentPage-1 & "" "Title=" "Last

Page "" class= "" PrevPage "" >&laquo;</a> "
Else
Pagestr = Pagestr &

"&nbsp;<a class=" "FirstPage" ">|&lsaquo;</a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "PrevPage" ">&laquo;</a>"
End If
If Xcurrentpage < Xpagecount

Then
Pagestr = Pagestr &

"&nbsp;<a href=" "" & strURL & "Page=" & Xcurrentpage + 1 & "" title= "" Next

Page "" class= "" NextPage "" >&raquo;</a> "
Pagestr = Pagestr &

"&nbsp;<a href=" "& strURL &" Page= "& Xpagecount &" "title=" "Last" "

class= "" LastPage "" >&rsaquo;|</a> "&vbcrlf
Else
Pagestr = Pagestr &

"&nbsp;<a class=" "NextPage" ">&raquo;</a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "LastPage" ">&rsaquo;|</a>" &vbcrlf
End If
Pagestr = Pagestr & "

<input id= "page" "type=" "Text" "Value=" "& Xcurrentpage &" "

Maxlength= "4" "title=" "Set page" "Size= ' 4 ' onmouseover=" "Javascript:this.focus

() This.select () "" Onkeydown= "" javascript:if (Window.event.keyCode = = 13)

Window.location.href= ' "& strURL &" Page= ' +this.value "" > "&vbcrlf
Pagestr = Pagestr & "

<input type= "button" "value=" "Go" "onclick=" "javascript:if

(document.getElementById (' page ')) window.location.href= ' "& strURL &

"Page= ' +document.getelementbyid" (' Page '). Value "" > "&vbcrlf
Pagestr = Pagestr &

"</div>" &vbcrlf
Case "3" ' Pagination Style 3: Display home page

, Top 10, bottom 10, last, and middle section of page number
Pagestr = pagestr & "<div

Id= "" ShowPage "" > "
Pagestr = pagestr & "<a

class= "" Totalpage "" > All "&xPageName&":<b> "& Xtotalnum &" </b> "& Xunitname

& "</a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "PageInfo" "> Page:<b>" & Xcurrentpage & "/" & Xpagecount &

"</b></a>"
p = (xCurrentPage-1) 10
If xcurrentpage = 1 Then
Pagestr = Pagestr &

"&nbsp;<a class=" "FirstPage" ">|&lsaquo;</a>"
Else
Pagestr = Pagestr &

"&nbsp;<a href=" "" & strURL & "page=1" "title=" "Home"

class= "" FirstPage "" >|&lsaquo;</a> "
End If
If p * > 0 Then
Pagestr = Pagestr &

"&nbsp;<a href=" "" & strURL & "Page=" & xCurrentPage-10 & "" title= "" 10

Page "" class= "" PrevPage "" >&laquo;</a> "
End If
For i= (p * ten + 1) to (p *

10 + 10)
If i = Xcurrentpage

Then
Pagestr =

Pagestr & "&nbsp; [<font color= ' Red ' ><a class= "" CurrentPage "" > "& I &

"</A></FONT>]"
Else
Pagestr =

Pagestr & "&nbsp;<a href=" "& strURL &" Page= "& I &" "title=" "Go to" &

I & "page" "class=" "GoToPage" ">" & I & "</a>"
End If
If i = Xpagecount

Then Exit for
Next
If I < Xpagecount Then

Pagestr = pagestr & "&nbsp;<a href=" "& strURL &" Page= "& I &" "title=" "

Next 10 page "" Class= "" NextPage "" >&raquo;</a> "
If xcurrentpage = Xpagecount

Then
Pagestr = Pagestr &

"&nbsp;<a class=" "LastPage" ">&rsaquo;|</a>"
Else
Pagestr = Pagestr &

"&nbsp;<a href=" "& strURL &" Page= "& Xpagecount &" "title=" "Last" "

class= "" LastPage "" >&rsaquo;|</a> "
End If
Pagestr = Pagestr &

"</div>" &vbcrlf
Case "4" ' Pagination Style 4: Display home page

And last page number, middle display part of page number
Pagestr = pagestr & "<div

Id= "" ShowPage "" > "
Pagestr = pagestr & "<a

class= "" Totalpage "" > All "&xPageName&":<b> "& Xtotalnum &" </b> "& Xunitname

& "</a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "PageInfo" "> Page:<b>" & Xcurrentpage & "/" & Xpagecount &

"</b></a>"
If xcurrentpage > 4 Then

Pagestr = pagestr & "&nbsp; [<a href= "" "& strURL &" Page=1 ""

class= "" FirstPage "" >1</a>]&nbsp;...&nbsp; "
If Xcurrentpage < PageCount

-3 Then PageTo = xcurrentpage + 3 Else pageto = Xpagecount
For I=xcurrentpage-3 to

PageTo
If I >= 1 Then
If i =

Xcurrentpage Then

Pagestr = pagestr & "&nbsp; [<font color= ' Red ' ><a class= "" CurrentPage "" > "&

I & "</A></FONT>]"
Else

Pagestr = pagestr & "&nbsp; [<a href= "" & strURL & "Page=" & I & "" "

class= "" GoToPage "" > "& I &" </A>] "
End If
End If
Next
If Xcurrentpage < Xpagecount

-3 Then pagestr = pagestr & "&nbsp;...&nbsp;<a href=" "" & strURL & "Page="

& Xpagecount & "" "Class=" "LastPage" ">" & Xpagecount & "</a>"
Pagestr = Pagestr &

"</div>" &vbcrlf
Case "5" ' Pagination Style 5: Display home page

, Prev, Next, last, all Chinese characters and go to the selection list of the page
Pagestr = pagestr & "<div

Id= "" ShowPage "" > "
Pagestr = pagestr & "<a

class= "" Totalpage "" > All "&xPageName&":<b> "& Xtotalnum &" </b> "& Xunitname

& "</a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "PageInfo" "> Page:<b>" & Xcurrentpage & "/" & Xpagecount &

"</b></a>"
If xcurrentpage > 1 Then
Pagestr = Pagestr &

"&nbsp;<a href=" "" & strURL & "Maxperpage=" & Xmaxperpage & "&page=1"

Title= "" Home "" class= "" FirstPage "" > Home </a> "
Pagestr = Pagestr &

"&nbsp;<a href=" "& strURL &" Maxperpage= "& Xmaxperpage &" &page= "&

XCurrentPage-1 & "" title= "" Previous page "" Class= "" FirstPage "" > Prev </a> "
Else
Pagestr = Pagestr &

"&nbsp;<font color= ' #999999 ' ><a class=" "FirstPage" "> Home </a></font>"
Pagestr = Pagestr &

"&nbsp;<font color= ' #999999 ' ><a class=" "PrevPage" "> Prev </a></font>"
End If
If Xcurrentpage < Xpagecount

Then
Pagestr = Pagestr &

"&nbsp;<a href=" "& strURL &" Maxperpage= "& Xmaxperpage &" &page= "&

Xcurrentpage + 1 & "" "Title=" "Next" "class=" "NextPage" "> Next </a>"
Pagestr = Pagestr &

"&nbsp;<a href=" "& strURL &" Maxperpage= "& Xmaxperpage &" &page= "&

Xpagecount & "" "Title=" "Last" "class=" "LastPage" "> Last </a>" &vbcrlf
Else
Pagestr = Pagestr &

"&nbsp;<font color= ' #999999 ' ><a class=" "NextPage" "> Next </a></font>"
Pagestr = Pagestr &

"&nbsp;<font color= ' #999999 ' ><a class=" "LastPage" "> Last </a></font>"
End If
Pagestr = Pagestr &

"&nbsp;<input type=" "Text" "Size= ' 4 ' name=" "Maxperpage" "Maxlength=" "2" "

Value= "" "& Xmaxperpage &" "onkeypress=" "if (event.keycode==13)

Window.location.href= ' "& strURL &" Maxperpage= ' +this.value; " >&nbsp; "&

Xunitname & "/page" &vbcrlf
Pagestr = pagestr & "&nbsp;

Go to: <select id= "page" "class=" "Pageselect" "

Onchange= "" Window.location.href= ' "& strURL &" Maxperpage= "& Xmaxperpage &

"&page= ' +this.options[this.selectedindex].value" ">" &vbcrlf
For I=1 to Xpagecount
Pagestr = Pagestr &

"<option value=" "& I &" "" "
If i = Xcurrentpage

Then pagestr = pagestr & "Selected"
Pagestr = Pagestr &

">" & I & "page </option>" &vbcrlf
Next
Pagestr = Pagestr & "

</select> "&vbcrlf
Pagestr = Pagestr &

"</div>" &vbcrlf
Case "6" ' Pagination Style 5: Display home page

, Prev, Next, last, digital page and turn text box
Pagestr = pagestr & "<div

Id= "" ShowPage "" > "
Pagestr = pagestr & "<a

class= "" Totalpage "" > All "&xPageName&":<b> "& Xtotalnum &" </b> "& Xunitname

& "</a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "PageInfo" "> Page:<b>" & Xcurrentpage & "/" & Xpagecount &

"</b></a>"
Pagestr = Pagestr &

"&nbsp;<a class=" "Totalpage" ">" &xMaxPerPage&xUnitName& "/Page </a>"
p = (xCurrentPage-1) 10
If xcurrentpage = 1 Then
Pagestr = Pagestr &

"&nbsp;<a class=" "FirstPage" ">|&lsaquo;</a>"
Else
Pagestr = Pagestr &

"&nbsp;<a href=" "" & strURL & "page=1" "title=" "Home"

class= "" FirstPage "" >|&lsaquo;</a> "
End If
If p * > 0 Then
Pagestr = Pagestr &

"&nbsp;<a href=" "" & strURL & "Page=" & xCurrentPage-10 & "" title= "" 10

Page "" class= "" PrevPage "" >&laquo;</a> "
End If
For i= (p * ten + 1) to (p *

10 + 10)
If i = Xcurrentpage

Then
Pagestr =

Pagestr & "&nbsp; [<font color= ' Red ' ><a class= "" CurrentPage "" > "& I &

"</A></FONT>]"
Else
Pagestr =

Pagestr & "&nbsp; [<a href= "" & strURL & "Page=" & I & "" title= "" Goto "&

I & "page" "class=" "GoToPage" ">" & I & "</A>]"
End If
If i = Xpagecount

Then Exit for
Next
If I < Xpagecount Then

Pagestr = pagestr & "&nbsp;<a href=" "& strURL &" Page= "& I &" "title=" "

Next 10 page "" Class= "" NextPage "" >&raquo;</a> "
If xcurrentpage = Xpagecount

Then
Pagestr = Pagestr &

"&nbsp;<a class=" "LastPage" ">&rsaquo;|</a>" &vbcrlf
Else
Pagestr = Pagestr &

"&nbsp; [<a href= "" & strURL & "Page=" & Xpagecount & "" title= "" Last ""

class= "" LastPage "" >&RSAQUO;|</A>] "&vbcrlf
End If
Pagestr = pagestr & "&nbsp;

Go: <input id= "" Page "size= ' 4 ' type=" "Text" "Value=" "" & Xcurrentpage &

"" "Maxlength=" "4" "title=" "onmouseover=" "Javascript:this.focus

() This.select () "" Onkeydown= "" javascript:if (Window.event.keyCode = = 13)

Window.location.href= ' "& strURL &" Page= ' +this.value "" > page "&vbcrlf

Pagestr = Pagestr &

"</div>" &vbcrlf

End Select
End If
Else
Pagestr = "" &vbcrlf
End If
ShowPage = Pagestr
End Function


End Class
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.