iframe中的各種跳轉方法
一、背景A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,在D中跳轉頁麵的寫法區別如下。
二、JS跳轉
window.location.href、location.href 本頁麵跳轉,D頁麵跳轉
parent.location.href 上一層頁麵跳轉,C頁麵跳轉
top.location.href 最外層頁麵跳轉,A頁麵跳轉
三、鏈接<a>或者form
D頁麵中有form
<form>: form提交後D頁麵跳轉
<form target="_blank">: form提交後彈出新頁麵
<form target="_parent">: form提交後C頁麵跳轉
<form target="_top"> : form提交後A頁麵跳轉
四、刷新
parent.location.reload():C頁麵刷新
window.opener.document.location.reload():C頁麵刷新(使用子窗口的opener對象來獲得父窗口對象)
top.location.reload():A頁麵刷新
原帖地址:https://blog.csdn.net/yuling59520/article/details/5630766
最後更新:2017-04-03 18:51:50