如题
<body onunload="self.window(windowname).close();">可以吗
<HTML><HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="Webdiyer">
<SCRIPT LANGUAGE="JavaScript">
<!--
var newwin;
function openWin(){
newwin=window.open("test.html","","width=400,height=200");
}
function closeWin(){
if(newwin!=null)
newwin.close();
}
//-->
</SCRIPT>
</HEAD>
<BODY onunload="closeWin()">
<button onclick="openWin()">open</button>
</BODY>
</HTML>
--------------------------------
AspNetPager 免费分页控件4.2版发布,同时发布最新源代码,欢迎下载:http://www.webdiyer.com
window.showModalDialog("DialogPage.aspx","newwin","dialogHeight: 200px; dialogWidth: 150px; dialog: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
newwin为新打开的窗口名称 resizable: Yes 为窗口可最大化,及可调整大小
设置 window.returnValue="aaa"; 可将"aaa" 作为返回值,在父窗口中可得到,不过仅陷于showModalDialog方法