好好学习,东方不败。

做个努力的小伙。

  博客园  :: 首页  :: 新随笔  ::  ::  :: 管理
使用js动态移动滚动条至底部。
var currentPosition,timer; 
function GoBottom(){ 
timer=setInterval("runToBottom()",50); 

function runToBottom(){ 
currentPosition=document.documentElement.scrollTop || document.body.scrollTop; 
currentPosition+=30; 
if(currentPosition<document.body.scrollHeight && (document.body.clientHeight + document.body.scrollTop < document.body.scrollHeight)) 

//window.scrollTo(0,currentPosition); 
//
alert(document.documentElement.clientHeight + " " + document.documentElement.scrollTop + " " + document.documentElement.scrollHeight + "#" +document.body.clientHeight + " " + document.body.scrollTop + " " + document.body.scrollHeight); 
document.body.scrollTop = currentPosition; 
} www.jbxue.com
else 

document.body.scrollTop = document.body.scrollHeight; 
clearInterval(timer); 

posted on 2014-04-25 05:27  snowfly123  阅读(1162)  评论(0编辑  收藏  举报