在父叶面打开子窗口时,将父业面作为参数传入,在子叶面用top.dialogArguments就可以获得父叶面了。如: //打开子窗口 //设置子窗口窗体属性 var left = (1024 - width) / 2; var top = (768 - height) / 2; var feature = 'dialogWidth:'+width+'px;dialogHeight:'+height+'px;dialogLeft:' + left + 'px;dialogTop:' + top +'px;status:no;help: no;'; //设置子窗口url var url = "b.jsp"; //打开子窗口 并传入自己的引用 showModalDialog(url,window,feature); 在子窗口就可以 var frm = top.dialogArguments; var atext = frm.document.all.atext.value;
如果是用window.open打开的 b页面 window.opener.document.getElementById("atxt").value
//打开子窗口
//设置子窗口窗体属性
var left = (1024 - width) / 2;
var top = (768 - height) / 2;
var feature = 'dialogWidth:'+width+'px;dialogHeight:'+height+'px;dialogLeft:' + left + 'px;dialogTop:' + top +'px;status:no;help: no;';
//设置子窗口url
var url = "b.jsp";
//打开子窗口 并传入自己的引用
showModalDialog(url,window,feature); 在子窗口就可以
var frm = top.dialogArguments;
var atext = frm.document.all.atext.value;
alert(parent.document.getElementById("atxt").value);