Thinkphp中文章顯示程式碼: 複製程式碼 程式碼如下: {$article.content|htmlspecialchars_decode} js實作程式碼: 複製程式碼 程式碼如下: <BR>var obj = document.getElementBydocument.getElementBy "showContent"); <BR>var pages= document.getElementById("articlePages"); <BR>//alert(obj.scrollHeight); <BR>window.onload= function() <BR>{ <BR>{ <BR> all=Math.ceil(parseInt(obj.scrollHeight)/ parseInt(obj.offsetHeight)); <BR>//取得總頁數,主要應用scrollHeight <BR>pages.innerHTML="共" all "頁"; <BR>for(var i=1; i<=all;i ) <BR>{ <BR>pages.innerHTML =" <a href=javascript:showPage('" i "');> " i "</ a> "; <BR>//輸出所有頁碼<BR>} <BR>} <BR>function showPage(pageIndex) <BR>{ <BR>obj.scrollTop = (pageIndex-1)* parseIntight ); <BR>} <BR> css代碼: 複製代碼 程式碼如下: #showContent { color:black; font-size: 16px; height: 700px; overflow: hidden>; #articlePages { text-align: right; }