关于js中"window.location.href"、"location.href"、"parent.location.href"、"top.location.href"的用法
时间:2019-01-02 13:53:25
收藏:0
阅读:184
A页面:<iframe src="b.html" frameborder="0"></iframe>
B页面:<iframe src="c.html" frameborder="0"></iframe>
C页面:<iframe src="d.html" frameborder="0"></iframe>
D页面:d.html
可以再 d.html 这样写:
"window.location.href"、"location.href":D页面跳转 获取D的地址
"parent.location.href":C页面跳转 获取C的地址
"top.location.href":A页面跳转 获取A的地址
如果D页面中有form的话,
<form>: form提交后D页面跳转
<form target="_blank">: form提交后 弹出新页面
<form target="_parent">: form提交后 C页面跳转
<form target="_top"> : form提交后 A页面跳转
"parent.location.reload();": C页面刷新 (
可以使用子窗口的 opener 对象来获得父窗口的对象:window.opener.document.location.reload(); )
"top.location.reload();": A页面刷新
原文:https://www.cnblogs.com/zhouhongdan/p/10208118.html
评论(0)