用javascript:
window.top.location.reload(); 或:window.parent.location.reload();
具体实例如下:
main页面:
<BODY>
asf sdfasdf
<iframe src="A.html">
</iframe> //引入A.html
</BODY>
A.html页面:
<script>
function re(){
window.top.location.reload();
}
</script>
<BODY>
<a href="#" onclick="javascript:re()">hhhhhhhhh
hhhhhhhhhhhhhhh</a>
</BODY>
这样话就会刷新父窗口啦..
window.top 当前窗口的最顶层窗口
window.top.location.reload(); 或:window.parent.location.reload();
具体实例如下:
main页面:
<BODY>
asf sdfasdf
<iframe src="A.html">
</iframe> //引入A.html
</BODY>
A.html页面:
<script>
function re(){
window.top.location.reload();
}
</script>
<BODY>
<a href="#" onclick="javascript:re()">hhhhhhhhh
hhhhhhhhhhhhhhh</a>
</BODY>
这样话就会刷新父窗口啦..
window.top 当前窗口的最顶层窗口
注意:不能跨域获取,例如iframe的src是'http://www.xxx.ccc/'就不可以
本文介绍了一种使用JavaScript来实现从iframe内部刷新其父窗口的方法。通过在iframe页面中调用`window.top.location.reload()`或者`window.parent.location.reload()`,可以达到刷新包含iframe的父页面的效果。需要注意的是,这种方法不能跨域使用。
5万+

被折叠的 条评论
为什么被折叠?



