Ultra-long article (HTML format) automatic paging, implements ASP and JS

xiaoxiao2021-03-06  75

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

These two days saw a friend who filed an article automatic paging, posted some of the code in the original system, for everyone to refer to, see if there is a need to improve, or have better suggestions, in fact, even the company's nearest project It is very small to use C #, ASP has been rarely used ... Here is only a part of code, interested friends, can test at http://demo.jaron.cn, managed http:///Demo.jaron.cn / adminTools account and password are Demo

Demonstration of the generated page: --------------- http: //demo.jaron.cn/sitemanager/59/2004-05/20040517001558-101502.htmlhttp: // demo. Jaron.cn/sitemanager/59/2004-05/20040517001558-101502_2.htmlhttp://demo.jaron.cn/sitemanager/59/2004-05/20040517001558-101502_3.htmlhttp://demo.jaron.cn/sitemanager/ 59 / 2004-05 / 20040517001558-101502_4.html

JavaScript script section ============================================================================================================================================================================ Take data with data 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.Document.body; var html = ""; for (var i = 0; i I I I I I = = = xildes [i] .nodety.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;}

The ASP script part ======================== "", -1, 1) INTCOUNT = Ubound (ACON) strTemp = "" strTemp2 = "Page = 1 for intfor = 0 to intcount strTemp = strTemp & actemp2 = startemp2 & removehtml (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 IfEnd 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 = startemp & actemp2 = s trTemp2 & RemoveHTML (aCon (intfor)) 'strTemp2 = strTemp2 & aCon (intFor) If Len (strTemp2)> = pSize Then If pagenum = Page Then get_page_text = strTemp Exit For End If Page = Page 1 strTemp = "" strTemp2 = "" End if next if straTemp2 <> "" and Pagenum>

转载请注明原文地址:https://www.9cbs.com/read-95413.html

New Post(0)