<HTML>
<HEAD>
<TITLE> 主窗口 </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<form id="getForm">
<input type="text" id="getData" readOnly>
</form>
<input type="button" value="open" onClick="openWin()">
<script language="JavaScript">
function openWin()
{
var obj = getForm;//表单的名字作为对象传过去
window.showModalDialog("BB.html", obj,"dialogHeight:300px; dialogLeft:200px;");
}
</script>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> 子窗口</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
BB.html
<form id="sendForm">
<input type="text" id="writeData">
<input type="button" value="aa" onClick="send(sendForm.writeData.value);">
</form>
<script language="JavaScript">
function send(val)
{
var myObj = window.dialogArguments;//关键的是它 表示得到你在父窗口里传递的对象
myObj.getData.value = val;//把子窗口的值传给父窗口
}
</script>
</BODY>
</HTML>
posted on 2006-03-29 10:29
xiaozhi 阅读(376)
评论(2) 编辑 收藏