@*點擊按鈕頁面刷新的時候記住滾動條的位置*@ 複製代碼 代碼如下: <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>scrollos = documscent. <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>