直接用showModalDialog传参数即可. 在B的Body中的onload中调用 function Init() { if(window.dialogArguments) { var strResult=window.dialogArguments; } } checkbox选中激发事件中调用 function OnOK() { window.returnValue="值"; var outResult=window.returnValue; window.close(); } 在A中: var outResult=showModalDialog('','',''); outResult就是传回的参数.
following is the example a.htm <input type=button value=openwindow onclick="winopen()"> <input type=hidden name=hidvalue> <script> function winopen() { window.open("b.htm","new window",""); } </script>b.htm<input type=checkbox name=cx value="ok" onclick="startthis(this.value)">ok<script> function startthis(par) { opener.document.all.hidvalue.value=par; window.close();} </script>
在B的Body中的onload中调用
function Init()
{
if(window.dialogArguments)
{
var strResult=window.dialogArguments;
}
}
checkbox选中激发事件中调用
function OnOK()
{
window.returnValue="值";
var outResult=window.returnValue;
window.close();
}
在A中:
var outResult=showModalDialog('','','');
outResult就是传回的参数.
opener.document.all."itemname".value=this.value;
window.close();
a.htm
<input type=button value=openwindow onclick="winopen()">
<input type=hidden name=hidvalue>
<script>
function winopen()
{
window.open("b.htm","new window","");
}
</script>b.htm<input type=checkbox name=cx value="ok" onclick="startthis(this.value)">ok<script>
function startthis(par)
{
opener.document.all.hidvalue.value=par;
window.close();}
</script>