window.showModalDialog methods and notes for refreshing the parent window and the window:
I. How to refresh the parent window:
A. Use Window.returnvalue to pass values to the parent window and then determine whether to refresh by value.
Set the return value in Window.returnvalue mode on the window.showModalDialog window page;
For example: window.returnvalue= ' Refresh ';
B. When writing the window.showModalDialog popup function, define a variable and then manipulate the parent window based on the value of the variable;
For example: Varwinpar=window.showmodaldialog (URLs, ' erpwindows ', ' dialogwidth= ' +widths+ ' px;dialogheight= ' +heigths+ ' px; Status=no;center=yes;scroll=no ');
if (Winpar = = "Refresh")
Window.location.reload ();//When the window.showModalDialog window is closed, execute
Winpar The return value set to the ShowModalDialog window for step a
Summary: Because the window.showModalDialog function opens an IE mode window (that is, you cannot manipulate the parent window after opening, only when the mode window is closed),
So to refresh the parent window only executes when the modal window is closed. The window.returnvalue can be used to pass values to the parent window so that the values can be passed to the parent window using the From modal window.
It then refreshes by determining how the parent window is manipulated according to the value. This will automatically refresh the stepfather window in any closed mode window.
Two. Refresh mode this window
ShowModalDialog window and window.open open window when refreshing this window, Showmodaldialo window can not be refreshed with F5, there is no right-click operation
A. In the modal window page, add:
<base target= "_self" >//Between HTML and body
<a id= "Reload" href= "this page url" style= "Display:none" ></a>
B. Perform the following JS where you need to perform the refresh operation:
Reload.click ();//reload to hide the ID of a tag in a, of course it can be replaced by a different name
Three. Precautions
When you click the link in the window.showModalDialog window, a new window opens and you want to block the opening of a new window, between the HTML and the body in the window page.
Join: <base target= "_self"/>
window.showModalDialog methods and notes for refreshing the parent window and the window