iframe怎样刷新父页面的父页面?

来源:百度知道 编辑:UC知道 时间:2024/05/29 13:22:27
index.jsp里面有两个框架,topFrame和mainFrame
在mainFrame包含的页面里,再嵌套一个iframe,我想知道怎样在这个iframe里去刷新topFrame的页面?谢谢大家!
在iframe那个页面里,还取不到Cookie了,请问这是怎么回事?
在这里,mainFrame是iframe的父页面,index.jsp又是topFrame和mainFrame的父页面,现在我想刷新的是topFrame

frame页面是内嵌到父页面的,当点击iframe页面的服务器控件时,默认只刷新iframe页面,父页面是不会刷新的。若想刷新父页面,可以使用js来实现,如
1. parent.location.reload();
这种方法会重新加载整个页面。但如果要在原页面的基础上传递参数,则可以使用下面的方法:
2.top.document.location.href='xxx.aspx?id=xx'。
但这两种方法都有一个共同的缺点,就是iframe内嵌页面的状态不会保存了,刷新后会重新回到第一次加载的状态。

<script>
parent.topFrame.location.href=parent.topFrame.location.href;
</script>