用ASP.NET怎样响应页面的关闭事件?
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>页面标题</title>
<script language="javascript" type="text/javascript">
function guanbi()
{
document.getElementById("buanbi").click();
}
</script>
</head>
<body class="body" onunload="guanbi()">
<input id="buanbi" name="buanbi" runat="server" onserverclick="Button1_ServerClick" type="button"
value="button" />
</body>
</html>
后台CS代码
protected void Button1_ServerClick(object sender, EventArgs e)
{
执行相关的操作
//Response.Write("<script>window.parent.opener=null;window.parent.close();</script>");
//Response.Write("<script>window.location.href='default.aspx';</script>");
JScript.ExecuteClientScript("window.close();", this.Page);
}
如果山不向我走来,我就向山走去!
![](http://www.cnblogs.com/Emoticons/baimantou/202015214.gif)