Basic operation method:
document.frames("frame_id").document.action;
where, frame_id is the id of the iframe that needs to be operated on the parent page, and action is the relevant operation in the iframe.
From this method, it can be seen that document.frames("frame_id") is used to obtain the id of the iframe from the parent page, and the subsequent document.action is the same as the general script operation on page elements. The specific example is To illustrate, the parent page refers to the iframe part as follows:
testIframe.jsp is as follows:
The script for operating iframe elements in the parent page is as follows:
This example describes reading elements in an iframe in the parent page and modifying elements in the iframe in the parent page The element's properties.
Through this example, we can see that there is no essential difference between accessing each element in the iframe in the parent page and general access to page elements. It is nothing more than obtaining the iframe object that needs to be processed in the parent page in advance. After obtaining the iframe object, its operation is basically nothing special.