window.top //最頂層窗口
window.self //當前窗口
window.parent //父級窗口框架
"window.location.href"、"location.href"是本頁面跳轉jsp
"parent.location.href"是上一層頁面跳轉url
"top.location.href"是最外層的頁面跳轉.net
舉例說明:orm
若是A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,若是D中js這樣寫對象
"window.location.href"、"location.href":D頁面跳轉blog
"parent.location.href":C頁面跳轉get
"top.location.href":A頁面跳轉iframe
若是D頁面中有form的話,io
<form>: form提交後D頁面跳轉
<form target="_blank">: form提交後彈出新頁面
<form target="_parent">: form提交後C頁面跳轉
<form target="_top"> : form提交後A頁面跳轉
關於頁面刷新,D 頁面中這樣寫:
"parent.location.reload();": C頁面刷新 (固然,也能夠使用子窗口的 opener 對象來得到父窗口的對象:window.opener.document.location.reload(); )
"top.location.reload();": A頁面刷新
在使用框架時,常常會對框架子頁面進行頁面引導的狀況,若是隻是簡單的設置location. href="",會使得整個頁面顯示在子框架中,致使出現重疊框架。如何解決呢?很簡單。只要指定子框架的父級框架頁面連接至目標頁面便可。如
window.top.framename.location.href = url;
window.parent.location.href=url;
mainframe.location.href=url;
原文地址: https://blog.csdn.net/jason_ldh/article/details/33732343