Usually open a new window using a window.open method.
To get the control of the parent window, you can use Window.opener to get the parent window
However, if you use ShowModalDialog ... is not valid
If necessary, you need to modify the open syntax and the syntax in ShowModalDialog
Open syntax The 2nd argument please go to self, example below
var rc=window.showmodaldialog (strurl,self,sfeatures);
And then there's the syntax to call the parent window.
var pwindow=window.dialogarguments;
This allows you to get control of the window object for the parent windows. For example:
Window.dialogArguments.document.getElementsByName ("ProcessID") [0].value;
the difference between opener and parent in JS
Opener that who opened my, such as a page using window.open pop-up b page window, then a page is the window is b page
Opener, you can access page A on the B page through the opener object.
Parent, such as a page with an IFRAME or a frame to call B page, then a page is the window is the B page
Parent
In JS, Window.opener is just a reference to the pop-up window's parent window. Like what:
In A.html, window.open a new window b.html by clicking on a button. Then in the b.html, you can pass
Window.opener (omitted to be written as opener) to refer to a.html, including a.html document and other objects, to manipulate the contents of a.html.
If this reference fails, then NULL is returned. So before you call the opener object, you have to determine whether the object is null, or you will
A JS error with "object is empty or does not exist" appears.
Copy Code code as follows:
<body>
<form. Name=form1>
<input Type=text Name=inpu >
<input Type=button >
</form>
</body>
Back2opener.html
Copy Code code as follows:
<body>
<form. Name=form1>
<input Type=text Name=inpu >
<a class=under href=# > Add </a>
</form>
</body>
Window.opener returns a reference to the window that created the current window, such as clicking a link on the a.htm and opening the
B.htm, then we're going to enter a value on the b.htm and then give the a.htm a textbox with the ID "name" to
Write as:
Window.opener.document.getElementById ("name"). Value = "entered data";