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