父窗口:
<html>
<head>
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function opendialog1()
{
var returnValue=window.showModalDialog("b.html","","dialogWidth=500px;dialogHeight=500px;status=no;help=no;scrollbars=no");
document.form1.p1t.value=returnValue;
}
</script>
</head>
<body>
<form name="form1" action="#">
<input type="text" name="p1t">
<input type="button" value="打开对话框" onclick="opendialog1()">
</form>
</body>
</html>
子窗口:
<html>
<head>
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function a()
{
var wname = document.form1.backname.value;
parent.window.returnValue=wname; //父窗口就是上一个页面
window.close();
}
</script>
</head>
<body>
<form name="form1" action="">
<input type="text" value="输入要传的值" name="backname">
<input type="button" value="传值" onclick="return a()">
</form>
</body>
</html>