There are two windows: a window (parent), b window (modal)
A a window has a DataGrid, a button.
When the button is clicked, the b window (modal) is ejected. Add the data in the b window, request the b window to shut itself down, and then refresh the window A (parent)
Copy Code code as follows:
<script type= "Text/javascript" >
function Opensubwin ()
{
window.showModalDialog (' b.html ', ' newwindow ', ' height=500, width=400, Top=0, left=0, Toolbar=no, Menubar=yes, Scrollbars=yes,resizable=yes,location=no, Status=no ');
Window.location.reload ();
}
</script>
Pop-up subform b.html, triggering parent page refresh when the subform is closed
Recently do the material system, but also related to modal window problem, the last time I did not encounter so many things, write it down
Parent Window JS Method
Copy Code code as follows:
function Openwin (ID) {
var answer=window.showmodaldialog ("demand.do?method=querybom&mdid=" +id+ "&d=" +escape (New Date ()), Window.self, "Dialogwidth:700px;dialogheight:620px:center:yes");
if (answer==1) {
Window.location.href = "demand.do?method=selmd&d=" +escape (New Date ()); Go to Processing page
Window.location.reload (); Refreshing the parent window
Winow.location.reload (TRUE);
}
}
Add an Escape (new Date ()) to avoid reading the cache, but also in the child window, add
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache, must-revalidate" >
Sub-window JS method:
Copy Code code as follows:
function ReVal () {
window.returnvalue=1; The value of the answer in the parent window
Window.close ();
}
After the modal window is opened, the parent window waits for the child window to return a value, and executes the Reval () method if it is a form submission or a button
Returns the value of answer, window.returnvalue=1 I tested this place. It seems that only string types can be returned, the array type is not good
Use Window.opener.location.reload () in the child window; Does not use, does not try in the modal window, Window.opern ()
There is also a problem: in the modal window, form submission will pop up a new window, the problem is simply in Can be done, note: I just start is not want to submit through form, with JS Window.location.href jump to different action to deal with, found
<base target= "_self" > does not work, it seems that <base target= "_self" > Just for the form action= "" To work, this place should be able to use IFRAME to achieve.