location.href用法總結(jié)(最主要的)
更新時間:2013年12月27日 10:38:35 作者:
location.href在使用中很是頻繁,接下來為大家詳細(xì)介紹下location.href主要的使用方法有哪些,感興趣的朋友可以參考下
javascript中的location.href有很多種用法,主要如下。
self.location.href=”/url” 當(dāng)前頁面打開URL頁面
location.href=”/url” 當(dāng)前頁面打開URL頁面
windows.location.href=”/url” 當(dāng)前頁面打開URL頁面,前面三個用法相同。
this.location.href=”/url” 當(dāng)前頁面打開URL頁面
parent.location.href=”/url” 在父頁面打開新頁面
top.location.href=”/url” 在頂層頁面打開新頁面
如果頁面中自定義了frame,那么可將parent self top換為自定義frame的名稱,效果是在frame窗口打開url地址
此外,window.location.href=window.location.href;和window.location.Reload()和都是刷新當(dāng)前頁面。區(qū)別在于是否有提交數(shù)據(jù)。當(dāng)有提交數(shù)據(jù)時,window.location.Reload()會提示是否提交,window.location.href=window.location.href;則是向指定的url提交數(shù)據(jù)
self.location.href=”/url” 當(dāng)前頁面打開URL頁面
location.href=”/url” 當(dāng)前頁面打開URL頁面
windows.location.href=”/url” 當(dāng)前頁面打開URL頁面,前面三個用法相同。
this.location.href=”/url” 當(dāng)前頁面打開URL頁面
parent.location.href=”/url” 在父頁面打開新頁面
top.location.href=”/url” 在頂層頁面打開新頁面
如果頁面中自定義了frame,那么可將parent self top換為自定義frame的名稱,效果是在frame窗口打開url地址
此外,window.location.href=window.location.href;和window.location.Reload()和都是刷新當(dāng)前頁面。區(qū)別在于是否有提交數(shù)據(jù)。當(dāng)有提交數(shù)據(jù)時,window.location.Reload()會提示是否提交,window.location.href=window.location.href;則是向指定的url提交數(shù)據(jù)
您可能感興趣的文章:
- JS的location.href跳出框架打開新頁面的方法
- IE下通過a實(shí)現(xiàn)location.href 獲取referer的值
- window.location.href的用法(動態(tài)輸出跳轉(zhuǎn))
- window.navigate 與 window.location.href 的使用區(qū)別介紹
- js實(shí)現(xiàn)網(wǎng)頁防止被iframe框架嵌套及幾種location.href的區(qū)別
- window.location.href = window.location.href 跳轉(zhuǎn)無反應(yīng) a超鏈接onclick事件寫法
- js獲取location.href的參數(shù)實(shí)例代碼
- location.href 在IE6中不跳轉(zhuǎn)的解決方法與推薦使用代碼
- JS 中document.URL 和 windows.location.href 的區(qū)別
- 淺析location.href跨窗口調(diào)用函數(shù)
相關(guān)文章
Javascript學(xué)習(xí)筆記之 函數(shù)篇(三) : 閉包和引用
本系列好久沒更新了,今天重新拿過來,繼續(xù)前面未完成的事項(xiàng),本文我們就來談?wù)凧avascript 中一個最重要的特性--閉包的使用引用。2014-11-11
JavaScript 入門基礎(chǔ)知識 想學(xué)習(xí)js的朋友可以參考下
JavaScript 基礎(chǔ)知識 想學(xué)習(xí)js的朋友可以參考下2009-12-12
在JS中操作時間之getUTCMilliseconds()方法的使用
這篇文章主要介紹了在JavaScript中操作時間之getUTCMilliseconds()方法的使用,是JavaScript入門學(xué)習(xí)中的基礎(chǔ)知識,需要的朋友可以參考下2015-06-06
「中高級前端面試」JavaScript手寫代碼無敵秘籍(推薦)
這篇文章主要介紹了JavaScript手寫代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04

