For a simple application of window.showmodaldialog, passing between parent-child windows
parent.htm < SCRIPT >
function showmd (ID)
{
var Sret = window.showModalDialog ("md.htm?id=" + Id,window, "scroll:0;status:0;help:0;resizable:0;dialogwidth:200px ;d ialogheight:170px ");
if (Sret = = "Refresh")//child window return value
{
Window.location.reload ();
}
}
</script >
< input type = "button" VALUE = "Display dialog box" onclick = SHOWMD (') "/>
md.htm < SCRIPT >
function Closemd ()
{
var parentwindow = window.dialogarguments; Connect to the object from the parent window
Window.returnvalue = "Refresh"; Returns the value of the parent window
Parentwindow.location = "http://www.baidu.com";
Window.close ();
}
</script >
< input type = "button" value = "Close Dialog" onclick = "closemd ()"/>
The code that passes the object to the child window and the return value to the parent window shows