父窗口window.showModalDialog传值 子窗口window.returnValue返回值

时间:2024-07-23 17:36:26

父窗口打开子窗口页面:

var fatherWindow = document.all.dealReason;//想传的值
 win = window.showModalDialog(strUrl, fatherWindow, "dialogWidth=800px;dialogHeight=600px;");

//strUrl是子窗口页面,fatherWindow是想传的值,win是子窗口返回的值
document.all.dealReason.value = win;

子窗口:

var dialogArgument = window.dialogArguments.value;//取父窗口的值

window.returnValue = dialogArgument;//传值给父窗口

window.close();