file1
============================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<form name="form1">
<input type="text" name="filename" />
</form>
<iframe src="file2.htm"></iframe>
</body>
</html>
file2
======================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<script>
window.parent.document.form1.filename.value="here is the filename";
</script>
</body>
</html>
============================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<form name="form1">
<input type="text" name="filename" />
</form>
<iframe src="file2.htm"></iframe>
</body>
</html>
file2
======================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<script>
window.parent.document.form1.filename.value="here is the filename";
</script>
</body>
</html>
在子窗体中opener.document.tid.value = 值;
父窗口:
<HTML>
<HEAD>
<title>test2</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script >
function getvalue()
{
var aa = showModalDialog("http://localhost/riqi/WebForm4.aspx", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0; help:0");
document.all.text.value = aa;
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体"><INPUT id ="text" style="Z-INDEX: 101; LEFT: 384px; POSITION: absolute; TOP: 88px" type="text"><INPUT style="Z-INDEX: 102; LEFT: 320px; POSITION: absolute; TOP: 208px" type="button"
value="Button" onclick ="getvalue()"></FONT>
</form>
</body>
</HTML>
-----------------------------------------
子窗口
<HTML>
<HEAD>
<title>WebForm4</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script>
function returnvalue()
{
window.returnValue = '33';
window.close();
} </script>
</HEAD>
<body onload="IframeID.document.designMode='on'" MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<INPUT style="Z-INDEX: 110; LEFT: 232px; POSITION: absolute; TOP: 224px" type="button"
value="return" onclick ="returnvalue()">
</form>
</body>
</HTML>