blog已經轉移至github,大家請訪問 http://qaseven.github.io/
window.history 對象包含瀏覽器的歷史。
window.history 對象在編寫時可不使用 window 這個前綴。
為了保護用戶隱私,對 JavaScript 訪問該對象的方法做出了限制。
一些方法:
history.back() 方法加載歷史列表中的前一個 URL。
這與在瀏覽器中點擊后退按鈕是相同的:
在頁面上創建后退按鈕:
<html> <head> <script> function goBack() { window.history.back() } </script> </head> <body> <input type="button" value="Back" onclick="goBack()"> </body> </html>
window.history.back()
以上代碼輸出為:
history forward() 方法加載歷史列表中的下一個 URL。
這與在瀏覽器中點擊前進按鈕是相同的:
在頁面上創建一個向前的按鈕:
<html> <head> <script> function goForward() { window.history.forward() } </script> </head> <body> <input type="button" value="Forward" onclick="goForward()"> </body> </html>
window.history.forward()
posted on 2014-04-01 14:22 順其自然EVO 閱讀(303) 評論(0) 編輯 收藏 所屬分類: js
Powered by: BlogJava Copyright © 順其自然EVO