Automatic paging of ultra-long articles (HTML format), implemented using ASP and JS

Source: Internet
Author: User

Source: http://blog.mvpcn.net/jaron/archive/2004/07/15/2159.aspx

In the past two days, I have seen a friend raise an automatic paging question and posted some of the code in my original system for your reference to see if there are any improvements or better suggestions, in fact, most of our company's recent projects use c #, and ASP is rarely used...
Only a part of the code is posted here. If you are interested, you can
Http://demo.jaron.cn test, management http://demo.jaron.cn/admintools account and password are both demo

Demo of the generated page:
---------------
Http://demo.jaron.cn/SiteManager/59/2004-05/20040517001558-101502.html
Http://demo.jaron.cn/SiteManager/59/2004-05/20040517001558-101502_2.html
Http://demo.jaron.cn/SiteManager/59/2004-05/20040517001558-101502_3.html
Http://demo.jaron.cn/SiteManager/59/2004-05/20040517001558-101502_4.html

JavaScript script
======================================
The following is a code snippet:
Function submitPostIfRame (mode ){
Var sMarkup = doc_html.getHTML (); // retrieve data from the html editor
With (document. forms [0]) {
Doc_html.document.open ();
Doc_html.document.write (sMarkup );
Doc_html.document.close ();
Doc_html.document.body.innerHTML = sMarkup;
Var oBody=doc_html.doc ument. body;
Var oHTML = "";
For (var I = 0; I if (I! = OBody. childNodes. length-1 ){
If (oBody. childNodes [I]. nodeType = 3 ){
OHTML + = oBody. childNodes [I]. nodeValue + "";
} Else {
OHTML + = oBody. childNodes [I]. outerHTML + "";
}
} Else {
If (oBody. childNodes [I]. nodeType = 3 ){
OHTML + = oBody. childNodes [I]. nodeValue;
} Else {
OHTML + = oBody. childNodes [I]. outerHTML;
}
}
}
News_content.value = oHTML
}
Return true;
}

ASP script
====================
The following is a code snippet:
Function calculate_pagination (strContent, pSize)
On Error Resume Next
Dim aCon, intfor, intCount, strTemp, strTemp2
ACon = Split (strContent, "",-1, 1)
IntCount = UBound (aCon)
StrTemp = ""
StrTemp2 = ""
Page = 1
For intfor = 0 To intCount
StrTemp = strTemp & aCon (intfor)
StrTemp2 = strTemp2 & RemoveHTML (aCon (intfor ))
'Strtemp2 = strTemp2 & aCon (intFor)
If Len (strTemp2)> = pSize Then
Page = Page + 1
StrTemp = ""
StrTemp2 = ""
End If
Next
'If strTemp2 <> "" Then Page = Page-1
Calculate_pagination = Page
If Err. Number <> 0 Then
Calculate_pagination = 1
Err. Clear
End If
End Function
Function get_page_text (strContent, pagenum, totalpage, pSize)
ACon = Split (strContent, "",-1, 1)
IntCount = UBound (aCon)
StrTemp = ""
StrTemp2 = ""
Page = 1
For intfor = 0 To intCount
StrTemp = strTemp & aCon (intfor)
StrTemp2 = strTemp2 & RemoveHTML (aCon (intfor ))
'Strtemp2 = strTemp2 & aCon (intFor)
If Len (strTemp2)> = pSize Then
If pagenum = Page Then
Get_page_text = strTemp
Exit
End If
Page = Page + 1
StrTemp = ""
StrTemp2 = ""
End If
Next
If strTemp2 <> "" And pagenum> Page-1 Then get_page_text = strTemp
End Function

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.