ASP document paging object

Source: Internet
Author: User
<%
STR = "Database Article Content testing content haha"
Function page (STR, fontnum)
If Len (STR)> fontnum then
If Len (STR) mod fontnum> 0 then' calculate the total number of pages
Pagecontent = Len (STR) \ fontnum + 1
Else
Pagecontent = Len (STR) \ fontnum
End if

Dim Arr ()
Redim Arr (pagecontent)

For M = 1 to pagecontent
If M <> pagecontent then
Arr (m) = mid (STR, (M * fontnum-fontnum + 1), fontnum)
Else
Arr (m) = mid (STR, (M * fontnum-fontnum + 1), Len (STR ))
End if
Next

If request. querystring ("page") <> "" then
Response. Write (ARR (request. querystring ("page ")))
Else
Response. Write (ARR (1 ))
End if

Response. Write ("<br> ")

For I = 1 to pagecontent
Response. Write ("<a href =? Page = "& I &"> "& I &" </a> ")
Next
Else
Response. Write (STR)
End if
End Function

Call page (STR, 5)
%>
If your content here is Rs ("body"), change the last sentence to call page (RS ("body"), 200 ).

I just wrote a rough picture above, which is not perfect, but it is basically like this.

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.