代码
<!--
parentForm.html
-->
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" />
< title > 父窗口 </ title >
</ head >
< script type ="text/javascript" >
function getOpenWinValue()
{
window.open( " childForm.html " );
}
</ script >
< body >
< form name ="frmParent" >
< input id ="txtUid" type ="text" />
< input name ="btnFind" type ="button" value ="..." onclick ="getOpenWinValue()" />
< form >
</ body >
</ html >
<!-- childForm.html -->
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" />
< title > 非模态子窗体 </ title >
< script type ="text/javascript" >
function returnValues()
{
opener.document.getElementById( " txtUid " ).value ="2012-12-20" ;
window.close();
}
</ script >
</ head >
< body >
< input type ="button" onclick ="returnValues()" value ="返回值" >
</ body >
</ html >
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" />
< title > 父窗口 </ title >
</ head >
< script type ="text/javascript" >
function getOpenWinValue()
{
window.open( " childForm.html " );
}
</ script >
< body >
< form name ="frmParent" >
< input id ="txtUid" type ="text" />
< input name ="btnFind" type ="button" value ="..." onclick ="getOpenWinValue()" />
< form >
</ body >
</ html >
<!-- childForm.html -->
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" />
< title > 非模态子窗体 </ title >
< script type ="text/javascript" >
function returnValues()
{
opener.document.getElementById( " txtUid " ).value ="2012-12-20" ;
window.close();
}
</ script >
</ head >
< body >
< input type ="button" onclick ="returnValues()" value ="返回值" >
</ body >
</ html >