<script type="text/
javascript">
var obj = document.getElementById("showContent");
var pages= document.getElementById("articlePages");
//alert(obj.scrollHeight);
window.onload= function()
{
var all=Math.ceil(parseInt(obj.scrollHeight)/ parseInt(obj.offsetHeight));
//获取总页数,主要是应用scrollHeight
pages.innerHTML="共"+ all +"页";
for(var i=1; i<=all;i++)
{
pages.innerHTML +=" <a href=javascript:showPage('"+i+"');> "+i+"</a> ";
//输出所有页码
}
}
function showPage(pageIndex)
{
obj.scrollTop = (pageIndex-1)* parseInt(obj.offsetHeight);
}
</script>