iframe
父窗口调用子窗口
var hasMore = parent.document.getElementByIdx_x_x_x("hasMore").value;
子窗口调用父窗口
document.frames["ifrmBoxFrame"].me.preLoadBoxGrid();
window.frames["iframe_ID"].document.getElementByIdx_x_x_x("iframe_document_object"-).object_attribute = attribute_value;
window
是对当前窗口自身的引用
如:
window.returnValue = ret;
window.close();
top
返回顶层窗口,即浏览器窗口。
如:
top.frames[tabID].location = url;
top.document.frames("ifrmBoxFrame").me.executeQueryCond();
parent
返回父窗口
如:
parent.$("Insheet_FrameTable").src = "";
parent.frames["Insheet_FrameSheetList"].initInsheetList(false);
opener
opener用于在window.open的页面引用执行该window.open方法的的页面的对象。例如:A页面通过window.open()方法弹出了B页面,在B页面中就可以通过opener来引用A页面,这样就可以通过这个对象来对A页面进行操作。
如:
var url="editarable.htm?arableID=" + curArableID+"&isDeleteDisabled="+$("Btn_delArable").disabled;
window.open(url, "viewArable", "height=" + h + ",width=" + w + ",left=" + x + ",top=" +y + ",status=no,toolbar=no,menubar=no,location=no");
//第二个页面中 使用opener
if(!(window.opener==null || window.opener.closed)){
window.opener.me.queryArable();
}
window.close();
首先来说说 parent.window与top.window的用法
"window.location.href"、"location.href"是本页面跳转
"parent.location.href"是上一层页面跳转
"top.location.href"是最外层的页面跳转
举例说明:
如果A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写
"window.location.href"、"location.href":D页面跳转
"parent.location.href":C页面跳转
"top.location.href":A页面跳转
parent.frames("frmEletroDocAttachInsert").frames("fraEletroDocAttachView").document.location = "about:blank";
top.document.frames('ifrmMainFrame').location.reload();