1. Child page Call Parent page method
Parent page
var showmodalwin= function (Url,win)
{
window.showModalDialog (URL, Win, "Dialogwidth=800px;dialogheight=450px;scroll:no");
}
function Showwin_click () {
Showmodalwin ("uploadmeetingrec.html?userno=51052002320&rq=123&r=" +math.random (), window)
}
function bb () {alert (1);}
Children page
Call Parent page function
function Finish (msg) {
WINDOW.PARENT.DIALOGARGUMENTS.BB ();
}
2. Child page return value to parent page
Parent page
Function Show () {
var params = new Array ();
Params[0] = "00000000000";
PARAMS[1] = "1111111111";
Params[2]= "22222222222";
var style = "Dialogheight:600px;dialogwidth:800px;status:no";
var k=window.showmodaldialog ("child.html", params, style);
if (k.type== "") {//pass back the type is empty when the page is refreshed.
Alert ("Refresh Me");
Location.reload ();
}
}
Child page
<script type= "Text/javascript" >
<!--//-
var s = new Object ();
S.type= ""; Set to empty to refresh the parent window
Window.returnvalue=s;
var l_array=new array ();
l_array=window.dialogarguments;
var aa=l_array[0];
var bb=l_array[1];
var cc=l_array[2];
alert (AA);
Alert (BB);
Alert (CC);
function CloseWindow () {
Window.close ();
}
function Donotrefresh () {
var s=new Object ();
S.type= "OK";//Set the return value, the value can be arbitrarily written, not empty. This returns the parent page is not refreshed.
Window.returnvalue=s;
Window.close ();
}
</script>
Parent-child form return value vs. Interop