1, the IFRAME child page calls the parent page JS function
The child page calls the parent page function just write window.praent on it. For example, when you call a () function, you write:
WINDOW.PARENT.A ();
The child page takes the value from the label in the parent page, such as the label's ID of "test", then:
Window.parent.document.getElementById ("Test"). Value;
The jquery method is:
$ (window.parent.document). Contents (). Find ("Test"). Val ();
But I found out that this method is invalid in Chrome browser! After a long time to understand, in the Chrome 5+, window.parent can not run in the file://protocol, but after the release http://protocol is able to run. This method supports IE, the Firefox browser.
2, IFRAME parent page call page JS function
This is a bit more complicated, and the following methods support IE and Firefox browsers:
document.getElementById (' Ifrtest '). contentwindow.b ();
The child page takes the value from the label in the parent page, such as the label's ID of "test", then:
document.getElementById ("Test"). Value;
Note: Ifrtest is the id,b () of the IFRAME frame as the JS function of the sub page. Contentwindow property is the specified frame or the Window object where the iframe is located, ie can be omitted.