JS:
Function dividecontent (contentdomid, linkdomid ){
VaR Max cotentheight = 600;
VaR lineheight = parseint (document. getelementbyid (contentdomid). style. lineheight );
Maxcotentheight = math. Ceil (maxcotentheight/lineheight) * lineheight;
Document. getelementbyid (contentdomid). style. Height = "";
VaR contentheight = Document. getelementbyid (contentdomid). scrollheight;
If (contentheight> maxcotentheight ){
Document. getelementbyid (contentdomid). style. Height = maxcotentheight + "PX ";
}
// A bug is fixed below: The last page is always full, and blank spaces are automatically added to the last page.
If (contentheight % maxcotentheight! = 0 & contentheight> maxcotentheight ){
VaR extrahieght = maxcotentheight-contentheight % maxcotentheight;
VaR extrahtml = '<Div style = "height:' + extrahieght + 'px; width: 100%"> </div> ';
Document. getelementbyid (contentdomid). innerhtml ++ = extrahtml;
}
VaR pagecount = math. Ceil (contentheight/maxcotentheight );
If (pagecount> 1 ){
VaR linkhtml = "";
For (VAR I = 0; I <pagecount; I ++ ){
Linkhtml + = '[<span style = "cursor: pointer; text-Decoration: underline; color: Blue; font-weight: bold" onclick = "document. getelementbyid (/''+ contentdomid + '/'). scrolltop = '+ I * maxcotentheight +' "> '+ (1 + I) +' </span>] & nbsp ;';
}
Document. getelementbyid (linkdomid). innerhtml = linkhtml;
}
Document. getelementbyid (contentdomid). style. Overflow = 'den den ';
Document. getelementbyid (contentdomid). style. Display = 'block ';
Document. getelementbyid (contentdomid). style. Visibility = 'visable ';
Document. getelementbyid (contentdomid). scrolltop = 0;
}
HTML:
<Div id = "articlecontent" style = "line-Height: 16px; Height: 592px; overflow: hidden;">
{$Article.html}
</Div>
<Div id = "articlecontentlink" style = "line-Height: 16px;" align = "center">
</Div>