Home  >  Article  >  Web Front-end  >  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中世界最好的语言
php中世界最好的语言Original
2018-04-26 15:29:071521browse

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
)

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

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

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");

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");

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

window.parent.func();

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!

Statement:
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