Home > Article > Web Front-end > JavaScript calling method between parent and child forms_javascript skills
The example in this article describes the calling method between JavaScript parent and child forms. Share it with everyone for your reference. The details are as follows:
If you want to open a new window, use the window.open() method.
If you want to close your own window, use the window.close() method.
1. Parent form
In order to facilitate the parent window to operate the child window, you can define a variable for the window.open() method, for example:
var opW = window.open("tests.html","popup","width=300,height=300");
In this way, to close the sub-window, you can directly use: opW.close() method.
If the parent form wants to operate child window elements, the code is as follows:
2. Subform
The child window can use window.opener to reference the parent window, the code is as follows:
I hope this article will be helpful to everyone’s JavaScript programming design.