功能,把子页面的数值传递到父页面中
Parent..htm
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>
< html >
< head >
< script language ="JavaScript" > ...
function showchild()...{
window.open("child.htm","mywin", "menubar=no,width=400,height=100,resizeable=yes");
}
</ script >
</ head >
< body >
< input type ="button" onClick ="showchild()" value ="showchild" />
< input type ="text" id ="parent" />
</ body >
</ html >
< html >
< head >
< script language ="JavaScript" > ...
function showchild()...{
window.open("child.htm","mywin", "menubar=no,width=400,height=100,resizeable=yes");
}
</ script >
</ head >
< body >
< input type ="button" onClick ="showchild()" value ="showchild" />
< input type ="text" id ="parent" />
</ body >
</ html >
child.htm
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>
< html >
< head >
< script language ="JavaScript" > ...
function closechild()...{
var input=document.getElementById("child");
window.opener.document.getElementById("parent").value=input.value;
window.close();
}
</ script >
</ head >
< body >
< input type ="text" id ="child" />
< input type ="button" value ="close" onClick ="closechild()" />
</ body >
</ html >
< html >
< head >
< script language ="JavaScript" > ...
function closechild()...{
var input=document.getElementById("child");
window.opener.document.getElementById("parent").value=input.value;
window.close();
}
</ script >
</ head >
< body >
< input type ="text" id ="child" />
< input type ="button" value ="close" onClick ="closechild()" />
</ body >
</ html >