ASP Content Paging function

Source: Internet
Author: User
  1. <%
  2. '==============================================   
  3. ' function name: Contentpage   
  4. ' function: Content paging   
  5. ' parameters: 1, ocontent-----article content   
  6. ' 2, olink-----links   
  7. ' Finishing: www.asp tutorial program.cn   
  8. ' original article, reprint please keep this information, thank you   
  9. '==============================================   
  10. function contentpage (ocontent, Olink)
  11. Dim outstr, Arrcontent, NextPage, Arrpage
  12. If InStr (ocontent, "[nextpage]") <= 0 then 14>
  13. outstr = Ocontent
  14. Else
  15. nextpage = Request ("nextpage")
  16. arrcontent = Split (ocontent, "[nextpage]")
  17. Arrpage = UBound (arrcontent) + 1
  18. if (nextpage = "" or isnull (nextpage) or not IsNumeric (nextpage)) then   
  19. NextPage = 1
  20. Else
  21. nextpage = CInt (nextpage)
  22. End If
  23. If nextpage < 1 then
  24. NextPage = 1
  25. End If
  26. if nextpage > Arrpage then
  27. NextPage = Arrpage
  28. End If
  29. outstr = Arrcontent (nextpage-1)
  30. outstr = outstr "<br>"   
  31. for iii. = 1 to arrpage
  32. if III = nextpage then
  33. outstr = outstr "<font color=" "Red" ">" &III "</font>"   
  34. Else
  35. outstr = outstr "<a href=" "" &olink "Nextpage=" &III "" ">" &III "</a>"   
  36. End If
  37. next
  38. End If
  39. Contentpage = outstr
  40. End function
  41. ' =================demo==================   
  42. Dim sstrhtml, ostrhtml
  43. sstrhtml = "My name is Hu Lang [nextpage] Hu is Ku's Hu [nextpage] Wave is three points of water a good word of the waves [nextpage] not a handsome man oh [nextpage] a very ordinary person."   
  44. ostrhtml = "My name is Hu Lang, Hu is Ku Hu, the wave is three points of water a good word of the wave, not a handsome man oh, very ordinary a person"   
  45. ' =================demo==================   
  46. Response.Write ("-------------------with paging---------------------")
  47. Response.Write ("<br>")
  48. Response.Write (Contentpage (sstrhtml, "?" ) ))   
  49. Response.Write ("<br>")
  50. Response.Write ("-------------------without paging---------------------")
  51. Response.Write ("<br>")
  52. Response.Write (Contentpage (ostrhtml, "?" ) ))   
  53. %>

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.