Call the aaa function in the parent
In the child page:
onclick="window.parent.frames.aaa()"
In the parent page:
function aaa() { alert(‘bbbbb'); }
The page in the frame frame needs to be changed to other pages under the same frame or the parent frame The page uses parent
window.opener refers to the parent page of the page opened by window.open.
window.frames object can refer to the page in the iframe or the page in the frameset.
can be like this
window.frames[0].document.getElementById(‘xx');
can be like this
window.frames[0].document.body.innerHTML; frm = window.parent.window.frames[‘uploadFrame']; frmDocument = frm.document; frm.sb(3); //sb 是uploadFrame页面里的一个函数
For firefox
If you encounter an error :parent.document.frames has no properties
Just replace it with the following code. This code is compatible with IE and FF. frm = window.parent.window.frames['uploadFrame']; In fact, the frames collection is not hung on the document but It is hung under the window object.
Please note that there are restrictions on modifying the page in the frame, that is, it must be under the same domain, otherwise it cannot be accessed
If it is under the same domain, but the subdomain name is different, then the js and html involved Add one sentence to each document.
document.domain = xxx.com [这里填写你的域名] document.getElementById(‘iframeid').contentWindow.document.getElementById(‘someelementid');
js pop-up page and call the parent page function
(for example: call the parent page function test2())
window.opener.test2();
The frame sub-page calls the previous page method
(For example: the frame frame of the previous page is named menuBar, and the onhook() function is called)
window.top.frames["menuBar"].onhook();
js pop-up page calls the parent page frame subpage function
(For example: pop-up page call, frame name is menuBar)
window.opener.top.frames['menuBar'].onhook();