Iframe pages are embedded in the parent page. Generally, iframe pages are used by default for relevant actions in the iframe, which does not affect the parent page. What should I do if I need to operate the elements of the parent page on the Child pages of iframe?
To operate the parent page element on the iframe sub-page, you need to know the following two points:
(1) The iframe subpage and parent page must belong to the same domain.
(2) The object method for retrieving the parent page from the iframe page is parent.
Example:
<Body>
<Div id = "test"> </div>
<Iframe src = "http://www.phpernote.com/javascript-function/272.html"> </iframe>
</Body>
In the http://www.phpernote.com/javascript-function/272.html page, add the "iframe child Page Operation parent page element" to the content of the id = "test" element of the parent page as follows:
Parent.doc ument. getElementById ('map _ position'). innerHTML = 'iframe sub-page operation parent page element ';
Similarly, if you need to refresh the parent page on the Child page, you can use: parent. location. reload ();
Articles you may be interested in
- How does jquery operate on iframe parent page elements?
- Optimization operations on a single page-Details determine the ranking
- How to control the order of page content loading
- How to optimize website pages and increase webpage loading speed
- Prohibit web page right-click, copy, save as, View Source file and other functions to implement web page source code protection
- How to set the jump wait time for the thinkphp page Jump (successerror)
- Js address bar special effects (display the size of all images with links on the page and view the height of the current browser)
- Three solutions for ineffective page refresh caused by Js, css, and images cached on webpages