一、最外層top跳轉(zhuǎn)頁(yè)面,適合用于iframe框架集top.window.location.href("${pageContext.request.contextPath}/Login_goBack");============================================================================================二、window.location.href和window.location.replace的區(qū)別 1.window.location.href=“url”:改變url地址; 2.window.location.replace(“url”):將地址替換成新url,該方法通過(guò)指定URL替換當(dāng)前緩存在歷史里(客戶端)的項(xiàng)目,因此當(dāng)使用replace方法之后,你不能通過(guò)“前進(jìn)”和“后 退”來(lái)訪問(wèn)已經(jīng)被替換的URL,這個(gè)特點(diǎn)對(duì)于做一些過(guò)渡頁(yè)面非常有用!三、強(qiáng)制頁(yè)面刷新 1.window.location.reload():強(qiáng)制刷新頁(yè)面,從服務(wù)器重新請(qǐng)求! ============================================================================================四、window.location.reload();頁(yè)面實(shí)現(xiàn)跳轉(zhuǎn)和刷新 1 history.Go(0)2 location.reload()3 location=location4 location.assign(location)5 document.execCommand('Refresh')6 window.navigate(location)7 location.replace(location)8 document.URL=location.href這幾個(gè)都可以刷新window.location.reload();刷新window.location.href=window.location.href;刷新window.close();關(guān)閉窗口,不彈出系統(tǒng)提示,直接關(guān)閉 window.close()相當(dāng)于self屬性是當(dāng)前窗口window.parent.close()是parent屬性是當(dāng)前窗口或框架的框架組頁(yè)面實(shí)現(xiàn)跳轉(zhuǎn)的九種方法實(shí)例:<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>navigate</title><script language="javaScript"> setTimeout('window.navigate("top.html");',2000); setTimeout('window.document.location.href="top.html";',2000); setTimeout('window.document.location="top.html";',2000); setTimeout('window.location.href="top.html";',2000); setTimeout('window.location="top.html";',2000); setTimeout('document.location.href="top.html";',2000); setTimeout('document.location="top.html";',2000); setTimeout('location.href="top.html";',2000); setTimeout('location.replace("top.html")',2000); //window對(duì)象 //document對(duì)象 //location對(duì)象 //href屬性 //1.window.document.location.href //2.window.document.location //3.window.location.href //4.window.location //5.document.location.href //6.document.location //7.location.href //8.window.navigate //9.location.replace //只要使用location方法,和任意的window對(duì)象,location對(duì)象,href屬性連用,都可以頁(yè)面的跳轉(zhuǎn)//// </script></head><body>頁(yè)面將在2秒后跳轉(zhuǎn)</body></html>解釋:location是個(gè)對(duì)象,比如本頁(yè)的document.location和window.location的屬性有 location.hostname = community.csdn.NET location.href = http://community.csdn.Net/Expert/topic/4033/4033372.xml?temp=2.695864E-02 location.host = community.csdn.net location.hash = location.port = location.pathname = /Expert/topic/4033/4033372.xml location.search = ?temp=2.695864E-02 location.PRotocol = http: 可見href是location的屬性,類別是string。
轉(zhuǎn)自:http://blog.csdn.net/wuya145/article/details/9114603
新聞熱點(diǎn)
疑難解答
圖片精選