Jquery and js call the iframe parent window and Child Window elements, jqueryiframe

Source: Internet
Author: User

Jquery and js call the iframe parent window and Child Window elements, jqueryiframe

1. The code for jquery to obtain the element of the parent page on the iframe subpage is as follows:

$ ("# Objid", parent.doc ument)

2. jquery obtains the element of the iframe subpage on the parent page.

The Code is as follows:

$ ("# Objid", document.frames('iframename'assist.doc ument)

3. The code for js to obtain the element of the parent page on the iframe subpage is as follows:

Indow.parent.doc ument. getElementByIdx_x ("element id ");

4. The code for js to obtain the iframe sub-page element on the parent page is as follows:

Window. frames ["iframe_ID" 2.16.doc ument. getElementByIdx_x ("element id ");

5. The sub-class iframe calls the parent class function:

Window. parent. func ();


How does the parent window obtain the JS method in the IFrame of the child window?

Set the ID for iframe
Document. getElementById ('iframeid'). contentWindow. abc ();
Abc () is a subpage function.

For js problems, the parent page opens the child page, and the Child page adds the function method that calls the parent page

How does the function of a webpage in iframe control the parent webpage?
Jquery method:
1) how to find the parent page element in iframe: (similarly, class)
$ ('# Id', using your parent.doc ument)

2) Call the methods and variables defined on the parent page in iframe:
Parent. method
Parent. value

3)
In the parent window, select all input boxes in IFRAME: $ (window. frames ["iframeSon" ].doc ument). find (": text ");
In the IFRAME field, select all input boxes in the parent window: Optional (w.w.parent.doc ument). find (": text ");

Js method:
Parent window operation IFRAME: window. frames ["iframeSon" mirror.doc ument
IFRAME operation parent window: paipaiparent.doc ument

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.