ASP Common Paging Program-Previous next page

Source: Internet
Author: User


'***********************************************
' Procedure name: ShowPage
' Function: Show "previous page next page" and other information
' parameter: sfilename----link Address
' Total number of totalnumber----
' Maxperpage----number per page
' Showtotal----Show total quantity
' Showallpages---whether to use the Drop-down list to display all the pages for jump. Some pages are not available, otherwise a JS error will appear.
' Strunit----count unit
'***********************************************
Sub ShowPage (Sfilename,totalnumber,maxperpage,showtotal,showallpages,strunit)

Dim n, I,strtemp,strurl
If Totalnumber mod maxperpage=0 then
n= Totalnumber Maxperpage
Else
n= Totalnumber maxperpage+1
End If
strtemp= "<table align= ' center ' ><form name= ' showpages ' method= ' Post ' action= '" & sFileName & "' > <tr><td> "
If Showtotal=true Then
Strtemp=strtemp & "Total <b>" & Totalnumber & "</b>" & Strunit & "&nbsp;&nbsp;"
End If
Strurl=joinchar (sFileName)
If Currentpage<2 Then
Strtemp=strtemp & "First prev &nbsp;"
Else
Strtemp=strtemp & "<a href= '" & strURL & "Page=1 ' > Home </a>&nbsp;"
Strtemp=strtemp & "<a href= '" & strURL & "Page=" & (CurrentPage-1) & "' > Previous </a>&nbsp;"
End If

If N-currentpage<1 Then
Strtemp=strtemp & "Next Page last"
Else
Strtemp=strtemp & "<a href= '" & strURL & "Page=" & (currentpage+1) & "' > Next page </a>&nbsp;"
Strtemp=strtemp & "<a href= '" & strURL & "Page=" & N & "' > Last </a>"
End If
Strtemp=strtemp & "&nbsp; page: <strong><font color=red>" & currentpage & "</font>/" & N & "</strong> page"
Strtemp=strtemp & "&nbsp;<b>" & Maxperpage & "</b>" & strunit & "/page"
If Showallpages=true Then
Strtemp=strtemp & "&nbsp; goto: <select name= ' page ' size= ' 1 ' onchange= ' javascript:submit () ' > '
For i = 1 to n
Strtemp=strtemp & "<option value= '" & I & "'"
If CInt (currentpage) =cint (i) then Strtemp=strtemp & "selected"
Strtemp=strtemp & "> First" & I & "Page </option>"
Next
Strtemp=strtemp & "</select>"
End If
Strtemp=strtemp & "</td></tr></form></table>"
Response.Write strtemp
End Sub

'***********************************************
' Procedure name: Enshowpage
' Function: Show "previous page next page" and other information
' parameter: sfilename----link Address
' Total number of totalnumber----
' Maxperpage----number per page
' Showtotal----Show total quantity
' Showallpages---whether to use the Drop-down list to display all the pages for jump. Some pages are not available, otherwise a JS error will appear.
' Strunit----count unit
'***********************************************
Sub Enshowpage (Sfilename,totalnumber,maxperpage,showtotal,showallpages,strunit)
Dim n, I,strtemp,strurl
If Totalnumber mod maxperpage=0 then
n= Totalnumber Maxperpage
Else
n= Totalnumber maxperpage+1
End If
strtemp= "<table align= ' center ' ><form name= ' showpages ' method= ' Post ' action= '" & sFileName & "' > <tr><td> "
If Showtotal=true Then
Strtemp=strtemp & "Total <b>" & Totalnumber & "</b>" & Strunit & "&nbsp;&nbsp;"
End If
Strurl=joinchar (sFileName)
If Currentpage<2 Then
Strtemp=strtemp & "The previous&nbsp;"
Else
Strtemp=strtemp & "<a href= '" & strURL & "Page=1 ' >First</a>&nbsp;"
Strtemp=strtemp & "<a href=" "& strURL &" Page= "& (CurrentPage-1) &" ' >Previous</a>& nbsp; "
End If

If N-currentpage<1 Then
Strtemp=strtemp & "Next Last"
Else
Strtemp=strtemp & "<a href= '" & strURL & "Page=" & (currentpage+1) & "' >next</a>&nbsp ;"
Strtemp=strtemp & "<a href= '" & strURL & "Page=" & N & "' >Last</a>"
End If
Strtemp=strtemp & "&nbsp; Page no.:<strong><font color=red> "& currentpage &" </font>/"& N &" </strong> Page "
Strtemp=strtemp & "&nbsp;<b>" & Maxperpage & "</b>" & Strunit & "/page"
If Showallpages=true Then
Strtemp=strtemp & "&nbsp; Turn to:<select name= ' page ' size= ' 1 ' onchange= ' javascript:submit () ' > '
For i = 1 to n
Strtemp=strtemp & "<option value= '" & I & "'"
If CInt (currentpage) =cint (i) then Strtemp=strtemp & "selected"
Strtemp=strtemp & ">no." & I & "Page</option>"
Next
Strtemp=strtemp & "</select>"
End If
Strtemp=strtemp & "</td></tr></form></table>"
Response.Write strtemp
End Sub

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.