parent.hmtl 复制代码 代码如下: 父窗口 <br><br>window.onload=function(){ <BR>var btn=document.getElementById("btn"); <BR>btn.onclick=function(){ <BR>var obj={ <BR>test:"张三传到子窗口", <BR>win:window <BR>}; <BR>var returnValue = window.showModalDialog("child.html",obj,"dialogLeft:100px;dialogTop:100px;dialogWidth:400px;dialogHeight:300px;resizable:yes"); <BR>if(returnValue != null){ <BR>document.getElementById("content").innerHTML = returnValue; <BR>} <BR>}; <BR>} <BR> child.html 复制代码 代码如下: 子窗口 <BR>window.onload=function(){ <BR>//获取url的传参 <BR>var args = window.dialogArguments; <BR>var win = args.win;//父窗口对象 <BR>var content=document.getElementById("content"); <BR>content.value=args.test; <BR>var btn=document.getElementById("btn"); <BR>btn.onclick=function(){ <BR>//模态对话框将值 <BR>window.returnValue = content.value; <BR>window.close(); <BR>} <BR>} <BR>