Home  >  Article  >  Web Front-end  >  Value transfer between Iframes in JS and application between subpages and parent pages_javascript skills

Value transfer between Iframes in JS and application between subpages and parent pages_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:40:461201browse

In js, we often use iframe as the system framework. In child pages, value transfer between parent pages is a problem. The following is js to obtain the object js of the parent form and child form:

1. Get the elements of the parent page in the iframe subpage :
a> window.parent.document is to get the object in the document of the parent page;
b> If you want to get Methods in parent page js: window.parent.xxxx(); a>


Copy code

The code is as follows: var child = document.getElementByIdx_x("mainFrame" ).contentWindow;//The id of mainFrame is the id of the parent page iframe child.document;//Get the document object in the child page;
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