Home  >  Article  >  Web Front-end  >  js method to implement iframe cross-page function calling_javascript skills

js method to implement iframe cross-page function calling_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:27:321457browse

The example in this article describes how js implements iframe cross-page function calling. Share it with everyone for your reference. The specific implementation method is as follows:

In the project, you will inevitably encounter such a problem that the page introduces IFrame and needs the parent page to call the child page function or the child page needs to call the parent page function. For example: There are now two pages parent.html and child.html. Among them, parent.html contains IFrame and IFrame points to child.html. Now you need to call a js method of child.html/parent.html in parent.html/child.html. 

The specific code implementation is as follows:

parent.html Parent page:

Copy code The code is as follows:









child.html subpage:

Copy code The code is as follows:








I hope this article will be helpful to everyone’s web programming based on JavaScript.

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