@*点击按钮页面刷新的时候 记住滚动条的位置*@ 复制代码 代码如下: <BR>window.onbeforeunload = function () { <BR>var scrollPos; <BR>if (typeof window.pageYOffset != 'undefined') { <BR>scrollPos = window.pageYOffset; <BR>} <BR>else if (typeof document.compatMode != 'undefined' && <BR>document.compatMode != 'BackCompat') { <BR>scrollPos = document.documentElement.scrollTop; <BR>} <BR>else if (typeof document.body != 'undefined') { <BR>scrollPos = document.body.scrollTop; <BR>} <BR>document.cookie = "scrollTop=" + scrollPos; //存储滚动条位置到cookies中 <BR>} <br><br>window.onload = function () { <BR>if (document.cookie.match(/scrollTop=([^;]+)(;|$)/) != null) { <BR>var arr = document.cookie.match(/scrollTop=([^;]+)(;|$)/); //cookies中不为空,则读取滚动条位置 <BR>document.documentElement.scrollTop = parseInt(arr[1]); <BR>document.body.scrollTop = parseInt(arr[1]); <BR>} <BR>} <BR>