父窗口与子窗口、子页面之间相互操作:
iframe:<iframe id="iframeId" name="iframeName" width="100%" src="a.jsp"><form id = "formid"></form></iframe>
父窗口获得子窗口对象并操作子对象:var iframeObj = document.getElementById("iframeId") 或 document.frames["iframeName"]
iframeObj.src = "a.jsp?random="+Math.random();
var html = iframeObj.document.getElementById("formid").innerHTML;
父窗口调用子窗口,子窗口执行完毕后,刷新当前父窗口:
window.location.href=window.location.href;
window.location.reload();
子窗口获得父窗口并操作父对象:var parentInputObj = window.parent.document.getElementById("inputId");
子窗口刷新父窗口并关闭子窗口:
(1)、window.parent.location.href=window.parent.location.href;
(2)、window.parent.location.reload();
window.close();
window.open:var openWindow = window.open('a.jsp?random='+Math.random(),'window','menubar=no,toolbar=no,location=no,directories=no,status=yes,resizable=0,scrollbars=1,width=520,height=150,top=200,left=200');
父窗口获得子窗口对象并操作子对象:openWindow.document.getElementById();
父窗口调用子窗口,子窗口执行完毕后,刷新当前父窗口:
window.location.href=window.location.href;
window.location.reload();
子窗口获得父窗口并操作父对象:var openerInputObj = window.opener.document.getElementById("inputId");
子窗口刷新父窗口并关闭子窗口:
(1)、window.opener.location.href=window.opener.location.href;
(2)、window.opener.location.reload();
window.close();
window.showModalDialog:var showWindow = window.showModalDialog('a.jsp?random='+Math.random(),window,'dialogwidth=1800px;dialogheight=350px;status:yes;titlebar:no;toolbar:no;scrollbars:yes;resizable:yes;center:yes');
父窗口获得子窗口对象并操作子对象:showWindow.document.getElementById();
父窗口调用子窗口,子窗口执行完毕后,刷新当前父窗口:
window.location.href=window.location.href;
window.location.reload();
子窗口获得父窗口并操作父对象:var parentWindow=window.dialogArguments;
var parentInputObj = parentWindow.document.getElementById();
子窗口刷新父窗口并关闭子窗口:
(1)、parentWindow.location.href=parentWindow.location.href;
(2)、parentWindow.location.reload();
window.close();
以上部分整理来源:http://hi.baidu.com/whmtorrent/item/055704be49de189318469704
iframe:<iframe id="iframeId" name="iframeName" width="100%" src="a.jsp"><form id = "formid"></form></iframe>
父窗口获得子窗口对象并操作子对象:var iframeObj = document.getElementById("iframeId") 或 document.frames["iframeName"]
iframeObj.src = "a.jsp?random="+Math.random();
var html = iframeObj.document.getElementById("formid").innerHTML;
父窗口调用子窗口,子窗口执行完毕后,刷新当前父窗口:
window.location.href=window.location.href;
window.location.reload();
子窗口获得父窗口并操作父对象:var parentInputObj = window.parent.document.getElementById("inputId");
子窗口刷新父窗口并关闭子窗口:
(1)、window.parent.location.href=window.parent.location.href;
(2)、window.parent.location.reload();
window.close();
window.open:var openWindow = window.open('a.jsp?random='+Math.random(),'window','menubar=no,toolbar=no,location=no,directories=no,status=yes,resizable=0,scrollbars=1,width=520,height=150,top=200,left=200');
父窗口获得子窗口对象并操作子对象:openWindow.document.getElementById();
父窗口调用子窗口,子窗口执行完毕后,刷新当前父窗口:
window.location.href=window.location.href;
window.location.reload();
子窗口获得父窗口并操作父对象:var openerInputObj = window.opener.document.getElementById("inputId");
子窗口刷新父窗口并关闭子窗口:
(1)、window.opener.location.href=window.opener.location.href;
(2)、window.opener.location.reload();
window.close();
window.showModalDialog:var showWindow = window.showModalDialog('a.jsp?random='+Math.random(),window,'dialogwidth=1800px;dialogheight=350px;status:yes;titlebar:no;toolbar:no;scrollbars:yes;resizable:yes;center:yes');
父窗口获得子窗口对象并操作子对象:showWindow.document.getElementById();
父窗口调用子窗口,子窗口执行完毕后,刷新当前父窗口:
window.location.href=window.location.href;
window.location.reload();
子窗口获得父窗口并操作父对象:var parentWindow=window.dialogArguments;
var parentInputObj = parentWindow.document.getElementById();
子窗口刷新父窗口并关闭子窗口:
(1)、parentWindow.location.href=parentWindow.location.href;
(2)、parentWindow.location.reload();
window.close();
以上部分整理来源:http://hi.baidu.com/whmtorrent/item/055704be49de189318469704