Home > Web Front-end > JS Tutorial > body text

How to get parent page elements from iframe subpages

高洛峰
Release: 2016-12-24 16:55:53
Original
1593 people have browsed it

Get the elements of the parent page in the iframe subpage

The code is as follows:

$.('#objld', parent.document);
Copy after login

Get the elements of the iframe subpage in the parent page
The code is as follows:

$("#objid", document.iframes('iframe').document)
Copy after login

or

$(document.getElementById('iframeId').contentWindow.document.body).html() $(document.getElementById('iframeId').contentWindow.document.body).html()
Copy after login

Display the content of the body element in the iframe

$("#testId", document.frames("iframename").document).html()
Copy after login


For more articles on how to obtain parent page elements from iframe subpages, please pay attention to the PHP Chinese website!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!