天天看点

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页面刷新

原帖地址:http://blog.csdn.net/yuling59520/article/details/5630766