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
Principle: Set a limited number of characters, calculate according to node, if the number of characters in one node does not exceed, then it is merged with the next node. It is displayed until the limit is exceeded.
JavaScript script section ======================================== (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 ohtml = ""; for (var i = 0; i
IF (i! = Obody.childNodes.Length-1) {
IF (Obody.childNodes [i] .NodeType == 3) {
Ohtml = Obody.childNodes [i] .NodeValue "{# cms-pagination-symbol #}";
} else {
Ohtml = Obody.childNodes [i] .outerhtml "{# cms-pagination-symbol #}";
}
} 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 part =============== function Calculate_pagination (strcontent, psize) on error resume next dim acon, intfor, intcount, strtemp, strtemp2 acon = split (strcontent, "{# cms- PAGINATION-SYMBOL #} ", -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 the page = page 1 strTemp = "" strTemp2 = "" "" "" "" "" "" "" "" " 1 Calculate_pagination = Page if Err.Number <> 0 Then Calculate_pagination = 1 Err.Clear End IFEND FUNCTION