瀏覽器的location 和history對象:一、location對象:1>location.reload() 相當於按瀏覽器上的“重新整理”(IE)或“Reload”(Netscape)鍵。 從web伺服器上再次裝入當前顯示的頁面。2>location.replace(url) 開啟一個 URL,並替換瀏覽器曆史列表中當前位置的地址。用這個方法開啟一個 URL 後,按下瀏覽器的“後退”鍵將不能返回到剛才的頁面。 demo:<body ><span id="myspan">fdasfdasdfasfdasfda</span><script>var s=document.getElementById("myspan");s.onclick=function(){location.reload("http://www.baidu.com");};</script></body>使用reload方法時,後退按鈕可以點擊,而使用replace()方法時,後退按鈕為灰色,不可點擊;a)解析URL的參數,產生json對象。var getURLParamsObj=function(url){ var n=url.indexOf("?"),parse = url.substring(n+1),arr = parse.split("&"),obj={};for(var i=0,len=arr.length; i<len; i++){var a = arr[i],name,value,pos = a.indexOf("=");if(pos == -1){continue;}name = a.substring(0,pos);value = a.substring(pos+1);obj[name]= decodeURIComponent(value);}return obj;}b)window.location與document.location的不同:1>window.location是一個對象,而document.location只是一個字串和document.url同義。2>大多數情況下,document.location和location.href是相同的,但是當存在伺服器重新導向時,document.location表示的是已裝載的URL,而location.href是原始請求文檔的URL二、history對象:window.history 即history是window對象的一個屬性a)支援三種方法:back(),forward(),go();b)基於Mozilla瀏覽器也支援window.back()和window.forward(),和後退,前進兩個按鈕功能相同,但是當使用幀的時候,window.back()和history.back()執行的操作不同。