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

iframe子页面获取父页面元素的方法_jquery

WBOY
Release: 2016-05-16 17:17:26
Original
879 people have browsed it

在iframe子页面获取父页面元素

代码如下:

复制代码 代码如下:

$.('#objld', parent.document);

在父页面获取iframe子页面的元素
代码如下:
复制代码 代码如下:

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


复制代码 代码如下:

$(document.getElementById('iframeId').contentWindow.document.body).html() $(document.getElementById('iframeId').contentWindow.document.body).html()

显示iframe中body元素的内容
复制代码 代码如下:

$("#testId", document.frames("iframename").document).html()
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!