1. 主页main.html
<html>
<head></head>
<script language="javascript" type="">
function show()
{
var x=(window.screen.width-200)/2;
var y=(window.screen.height-200)/2;
var value=window.open('open.htm','window','width=200,height=200,left='+x+',top='+y);
return value;
}
</script>
<body>
<form>
<input name="code" />
<input type="button" name="open" value="提示" onclick="web=show();"/>
<input type="button" name="close" value="关闭" onclick="web.close();"/>
</form>
</body>
</html>
2. 子窗口 open.html
<html>
<head>
<title>系统提示</title>
</head>
<script language="JavaScript" type="">
function closeWindow()
{
window.opener.document.all.code.value=text.value;
//window.opener.document.code.value=text.value;
window.close();
}
</script>
<body">
<input name="text"/><input type="button" value="返回" onClick="closeWindow();">
</body>
</html>