点击按钮,打开新页面关闭该页面
我是这么做的:
private void Button2_Click(object sender, System.EventArgs e)
{
Response.redirect( "a.aspx ");
Response.Write( " <script language:javascript> javascript:window.close(); </script> ");
}
已经能弹出页面了,可是就是关闭不了原页面!请高手指出我的错误
------解决方案--------------------Response.redirect的执行优先级比Response.Write高,所以Response.Write和Response.redirect放在一起使用时Response.Write永远不可能被执行到。所以要这样:
Response.Write( " <script> window.open( 'a.aspx '); </script> ");
Response.Write( " <script> window.close(); </script> ");