常用的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:
代码如下
复制代码
window.parent.frames.location.href="../welcome.en"
java:
PrintWriter out = response.getWriter();
out.write("");
return;
2.从一个框架跳转到 name="main" 的框架里。
代码如下
复制代码
var key = document.getElementById(" ## ").value;
window.parent.main .location.href= "welcome.en ? key=" + key;
3.ContentList 当前页的iframe名字
代码如下
复制代码
window.ContentList.location.href = '../welcome.en';