Home > Web Front-end > JS Tutorial > jquery and js directly call the elements in the iframe parent-child window (code attached)

jquery and js directly call the elements in the iframe parent-child window (code attached)

php中世界最好的语言
Release: 2018-04-26 15:29:07
Original
1567 people have browsed it

This time I will bring you jquery and js directly call the elements in the iframe parent-child window (with code), jquery and js directly call the elements in the iframe parent-child window Notes There are Which ones, the following are practical cases, let’s take a look.

1. jquery gets the elements of the parent page in the iframe sub-page. The code is as follows:

$("#objid", parent.
document
)
Copy after login

2. jquery gets the elements of the iframe sub-page in the parent page.

$("#objid",document.frames('iframename').document)
Copy after login

3.js in The code for the iframe sub-page to obtain the element of the parent page is as follows:

indow.parent.document.getElementByIdx_x("元素id");
Copy after login

4.js The code for the iframe sub-page element to be obtained from the parent page is as follows:

window.frames["iframe_ID"].document.getElementByIdx_x("元素id");
Copy after login

5. Call the parent class in the sub-class iframe Function :

window.parent.func();
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese website and other related articles!

Recommended reading:

jquery js calls iframe parent window and child window steps detailed explanation

##jquery ajax returns json Chinese garbled code How to deal with the phenomenon

The above is the detailed content of jquery and js directly call the elements in the iframe parent-child window (code attached). For more information, please follow other related articles on 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