加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

iframe中的各种跳转方法

(2016-11-14 11:11:09)
标签:

node

it

分类: Node
一、背景
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页面跳转

三、链接或者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页面刷新

五、代码示例一
<html>
<body>
<script>
    window.location.href = 'http://www.baidu.com';
</script>
</body>
</html>

代码示例二
<html>
<body>
<iframe src="http://www.sina.com/" frameBorder=0 width="100%" height="100%"></iframe>
</body>
</html>

代码示例三
<html>
<body>
<script>
   window.open('https://www.baidu.com','_self');
</script>
</body>
</html>

六、参考
http://blog.sina.com.cn/s/blog_67aaf4440101a1ot.html

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有