Window. showModalDialog refresh the parent window and the method and note of the current window. showmodaldialog
Window. showModalDialog methods and notes for refreshing the parent window and the current window:
I. Method to refresh the parent window:
A. Use window. returnValue to pass A value to the parent window, and then judge whether to refresh the window Based on the value.
On the window. showModalDialog window page, use window. returnValue to set the return value;
For example, window. returnValue = 'refresh ';
B. When writing window. showModalDialog window function, define a variable and operate the parent window according to the variable value;
Example: varwinPar = window. showModalDialog (urls, 'erpwindows', 'dialogwidth = '+ widths + 'px; dialogHeight =' + heigths + 'px; status = no; center = yes; scroll = no ');
If (winPar = "refresh ")
Window. location. reload (); // executed when the window. showModalDialog window is closed
The return value set by winPar for step A in the showModalDialog window
Conclusion: The window. showModalDialog function opens an IE mode window (that is, the parent window cannot be operated after the window is opened, and the operation can only be performed when the mode window is closed ),
Therefore, to refresh the parent window, you can only execute it after the mode window is closed. Window. returnValue can be used to pass a value to the parent window, so that the value can be transferred to the parent window in the mode window,
Then, refresh the parent window based on the value. In this way, the parent window will be automatically refreshed after any Mode window is closed.
Ii. Refresh mode this window
The showModalDialo window is different from the window opened by window. open When refreshing this window, the showModalDialo window cannot be refreshed with F5 or right-click
A. Add the following content to the mode window:
<Base target = "_ self"> // between html and body
<A id = "reload" href = "url of this page" style = "display: none"> </a>
B. Execute the following js Code where the refresh operation is required:
Reload. click (); // reload indicates the id of the hidden A tag in a. You can change it to another name.
3. Notes
When you click the link in the window. showModalDialog window, a new window is opened. To prevent the new window from being opened, you need
Add: <base target = "_ self"/>.