DIV CSS 佈局教程網

JavaScript href 用法:頁面跳轉與框架層級
編輯:關於JavaScript     

不同層級的 location.href

在頁面跳轉中,window.location.href 與 location.href 通常用來更新目前頁面;parent.location.href 會影響上一層框架;top.location.href 則會影響最外層頁面。若頁面被多層 iframe 包覆,這個差異會直接決定跳轉作用範圍。

表單 target 的影響

表單提交時,target 屬性會決定回應要載入到哪裡。未指定時通常會在目前頁顯示;加上 _blank 可開啟新視窗;_parent 會作用於上一層;_top 則會作用於最外層。

重新整理頁面

若需要更新上層頁面,可使用 parent.location.reload(); 或 top.location.reload();。在子視窗中,也可透過 window.opener 取得開啟它的父視窗物件,再進行更新或取值。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved