javascript中window.open()與window.location.href的區別

來源:互聯網
上載者:User

標籤:重新整理   log   個人總結   open   子視窗   表示   body   分享圖片   java   

window.open()

open() 方法用於開啟一個新的瀏覽器視窗或尋找一個已命名的視窗。

window.open(pageURL,name,parameters)  

其中:pageURL 為子視窗路徑

name 為子視窗控制代碼

parameters 為視窗參數(各參數用逗號分隔) 

window.open("index.jsp",‘top‘); 只是表示開啟這個頁面,並不是開啟並重新整理index.aspx

window.location.href

 表示重新定向到新頁面,同時重新整理開啟的這個頁面;

js頁面的書寫(案例)

 

self.location.href="/url" 當前頁面開啟URL頁面
location.href="/url" 當前頁面開啟URL頁面
windows.location.href="/url" 當前頁面開啟URL頁面,前面三個用法相同。
this.location.href="/url" 當前頁面開啟URL頁面
parent.location.href="/url" 在父頁面開啟新頁面
top.location.href="/url" 在頂層頁面開啟新頁面

 

個人總結

詳細請看

http://blog.csdn.net/xiaobing_122613/article/details/72763569

javascript中window.open()與window.location.href的區別

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.