<!-----------------主窗口  a.htm -------------------->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>主窗口</title>
<script type="text/javascript">
function fun_test(){
var txt="";
txt=window.showModalDialog("b.htm");
if (txt) spanTest.innerText=txt;
}
</script>
</head>
<body>
<input type="button" onClick="fun_test()" value="Click Me">
<span id="spanTest"></span>
</body>
</html>
<!-----------------没态窗口  b.htm -------------------->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>弹出模态窗口</title>
<script type="text/javascript">
function funTest2(){
window.returnValue=txtVal.value;
window.close();
}
</script>
</head>
<body>
请输入一个值,这个值会传个主窗口<input type="text" name="txtVal">
<input type="button" value="OK" onClick="funTest2()">
</body>
</html>