父页面javascript代码: function getParentFunction(){ var url = "<%=path%>/function.do?method=functionSel&first=yes"; //window.open (url, '选择父项', 'height=500, width=800, top=70, left=110, toolbar=no, menubar=no, resizable=no,location=n o, status=no') var returnValue=window.showModalDialog(url,'','dialogWidth=800px;dialogHeight=535px'); if(returnValue!=null && returnValue!=""){ document.getElementById("parentCode").value=returnValue; } } 弹出页面的javascript代码: function sel(){ if(parentCode==""){ alert("请选择一个功能!"); }else{ window.returnValue=parentCode; window.close(); //alert(parentCode); //window.opener.document.getElementById("parentCode").value=parentCode; //window.close(); } } 为避免分页时点上一页,下一页时又弹出一个新窗口,弹出页面中的head加入: <base target='_self'/>