主窗口 main.html
<html>
<head>
<script language="javascript">
function abc()
{
window.showModalDialog("newwindow.html",window,"dialogWidth:500px;dialogHeight:420px;help:0;status:0;resizable:0;scroll:0;center:1;");
}
</script>
</head>
<body>
<img οnclick=abc()>
<INPUT type="text" name="me">
</body>
</html>
对话框 newwindow.html
<html>
<head>
<script language="javascript">
var oParent;
function addvalue()
{
oParent = window.dialogArguments;
alert(document.all["a"].value);
oParent.document.all["me"].value=document.all["a"].value;
window.close();
}
</script>
</head>
<body>
<INPUT type="text" name="a" value="hello~">
<INPUT style="WIDTH: 80px" οnclick="addvalue();" type="button" value="给父窗体赋值">
</body>
</html>