js iframe框架页面跳转(跳出父框架)
发布时间:01/15 来源: 浏览:
关键词:
在网站后台弄好开发时我们常会需要点击退出或超时时间自动跳出我们当前的的框架页面,这们我们可以使用很多办法来解决,下面我来给各位同学介绍一些跳出框架的方法。
常用的iframe操作语句
"window.location.href"、"location.href"是本页面跳转
"parent.location.href"是上一层页面跳转
"top.location.href"是最外层的页面跳转
通过javascript从 框架页 向 父框架
parent.location.href="index.asp";
or
top.location.href="index.asp";
例
1.跳出框架,在父页面。
jsp:
代码如下 | |
<script language="javascript"> window.parent.frames.location.href="../welcome.en" </script> |
java:
PrintWriter out = response.getWriter();
out.write("<script type='text/javascript'>window.parent.frames.location.href = '../welcome.en';</script>");
return;
2.从一个框架跳转到 name="main" 的框架里。
代码如下 | |
<script language="javascript"> var key = document.getElementById(" ## ").value; window.parent.main .location.href= "welcome.en ? key=" + key; </script> |
3.ContentList 当前页的iframe名字
代码如下 | |
window.ContentList.location.href = '../welcome.en'; |