第一頁1.htm
<script>
function OpenWin(form)
{
//showModelessDialog
var str = window.showModalDialog('2.htm',form,
'dialogWidth:300px; dialogHeight:201px; center:yes');
if(str != null)
document.forms[0].textb.vaule = str;
}
</script>
<form name="form1" method="post" action="" onsubmit="return false" >
<input type="text" name="textb" />
<input type = "submit" name = "submit" value = "打開新窗口" onclick= "OpenWin(this.form);" />
</form>
第二頁2.htm
<title>Dialog</title>
<script>
function back()
{
window.dialogArguments.textb.value=document.form1.text1.value;
self.close();
}
</script>
<body>
<form name="form1" method="post" action="#" onSubmit="back()" >
<input type="text" name="text1" />
<input type = "submit" name = "submit" value = "返回" />
</form>
</body>

note :在第二頁要注意一點(diǎn)就是 當(dāng)提交的時(shí)會(huì)打一個(gè)新的窗體,把a(bǔ)ction 設(shè)為“#”,就不會(huì)這個(gè)情況。