2個頁面 一個是 father.htm 還有一個是 son.htmlfather.htm<!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><script language="javascript"> function ShowModal(){ var txt=document.getElementById("Text1"); txt.value=window.showModalDialog("son.htm");
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>爸爸</title><script language="javascript">
function ShowModal(){
var txt=document.getElementById("Text1");
txt.value=window.showModalDialog("son.htm");
}</script>
</head>
<body>
name<input id="Text1" type="text" disabled value=""/><input type="button" value="望远镜" onClick="ShowModal()"/>
</body>
</html>
son.htm<!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>
<script language="javascript">
window.onunload=function(){
window.returnValue=document.getElementById("name").value;
}
function CloseModal(){
window.opener=null;
window.close();
window.returnValue=document.getElementById("name").value;
}
</script>
</head><body>
<input id="name" type="text"/>
<input type="button" value="关 闭" onClick="CloseModal()"/>
</body>
</html>