页面到达底部时的自动刷新
window.onscroll=function(){var a = document.documentElement.scrollTop==0? document.body.clientHeight : document.documentElement.clientHeight;var b = document.documentElement.scrollTop==0? document.body.scrollTop : document.documentElement.scrollTop;var c = document.documentElement.scrollTop==0? document.body.scrollHeight : document.documentElement.scrollHeight;if(a+b==c){alert("new message");}}这段代码就可以实现 像 人人 QQ空间 等 当滚动条到达最底部时的自动刷新,应用就是:不一次性的给出所有数据,分批查找。
在 IE,火狐中均有效, 但是火狐中似乎还有小问题,当滚动条达到最上方时,也会刷新。