One paging function: displays "previous page" and so on.

Source: Internet
Author: User
One paging function: displays "previous page" and so on.

  1. '*************************************** ***********

  2. 'Function name: ShowPage
  3. 'Usage: displays "previous page" and other information
  4. 'Parameter: sFileName ---- link address
  5. 'Totalnumber ---- Total number
  6. 'Maxperpage'-number of pages per page
  7. 'Currentpage ---- current page
  8. 'Showtotal ---- whether to display the total number
  9. 'Showallpages --- whether to use the drop-down list to display all pages for redirect.
  10. 'Strunit ---- count unit
  11. 'Showmaxperpage ---- whether to display the information on each page option box
  12. 'Return value: the html code for "previous page" and other information
  13. '*************************************** ***********
  14. Function ShowPage (sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage)
  15. Dim TotalPage, strTemp, strUrl, I

  16. If totalnumber = 0 Or MaxPerPage = 0 Or IsNull (MaxPerPage) Then

  17. ShowPage = ""
  18. Exit Function
  19. End If
  20. If totalnumber Mod MaxPerPage = 0 Then
  21. TotalPage = totalnumber \ MaxPerPage
  22. Else
  23. TotalPage = totalnumber \ MaxPerPage + 1
  24. End If
  25. If CurrentPage> TotalPage Then CurrentPage = TotalPage

  26. StrTemp ="

    "
  27. If ShowTotal = True Then
  28. StrTemp = strTemp & "total"& Totalnumber &""& StrUnit &""
  29. End If
  30. If ShowMaxPerPage = True Then
  31. StrUrl = JoinChar (sfilename) & "MaxPerPage =" & MaxPerPage &"&"
  32. Else
  33. StrUrl = JoinChar (sfilename)
  34. End If
  35. If CurrentPage = 1 Then
  36. StrTemp = strTemp & "Home Page"
  37. Else
  38. StrTemp = strTemp & "homepage"
  39. StrTemp = strTemp & "previous page"
  40. End If

  41. If CurrentPage> = TotalPage Then

  42. StrTemp = strTemp & "next last page"
  43. Else
  44. StrTemp = strTemp & "next page"
  45. StrTemp = strTemp & "last page"
  46. End If
  47. StrTemp = strTemp & "page times:"& CurrentPage &"/"& TotalPage &"Page"
  48. If ShowMaxPerPage = True Then
  49. StrTemp = strTemp &""& StrUnit &"/page"
  50. Else
  51. StrTemp = strTemp &""& MaxPerPage &""& StrUnit &"/page"
  52. End If
  53. If ShowAllPages = True Then
  54. If TotalPage> 20 Then
  55. StrTemp = strTemp & "go toPage"
  56. Else
  57. StrTemp = strTemp & ":"For I = 1 To TotalPageStrTemp = strTemp &"If PE_CLng (CurrentPage) = PE_CLng (I) Then strTemp = strTemp & "selected"StrTemp = strTemp & "> page" & I &""NextStrTemp = strTemp &""
  58. End If
  59. End If
  60. StrTemp = strTemp &"
  61. "
  62. ShowPage = strTemp
  63. End Function
  64. ?>

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.