首页 > 代码库 > Response.Write 打开新窗口
Response.Write 打开新窗口
Response.Write 打开新窗口
string url=" XXX.aspx?aaa="+bbb";
Response.Write(" <script type=‘text/JavaScript‘>window.open(‘" + url + "‘,‘_blank‘); </script>");
Response.Write(" <script type=‘text/JavaScript‘>window.open(‘" + url + "‘); </script>");
Page.ClientScript.RegisterStartupScript(this.GetType(), "", " <script type=‘text/JavaScript‘>window.open(‘" + url + "‘); </script>");
==============================================================
asp.net中打开新窗口的多种方法
1.Response.Redirect("XXX.aspx",true)——直接转向新的页面,原窗口被代替;
2. Response.Write("<script>window.open(XXX.aspx‘‘,‘‘_blank‘‘)</script>")——原窗口保留,另外新增一个新页面;
3.Response.Write("<script>window.location=XXX.aspx‘‘</script>")——打开新的页面,原窗口被代替;
4.Server.Transfer("XXX.aspx")——打开新的页面;
5.Response.Write("<script>window.showModelessDialog(XXX.aspx‘‘)</script>")——原窗口保留,以对话框形式打开新窗口;
6.Response.Write("<script>window.showModalDialog(XXX.aspx‘‘)</script>")——对话框形式打开新窗口,原窗口被代替;
=======================================================
Response.Write("<script language=\"javascript\">window.open(‘aaa.aspx‘,‘新窗口,\"toolbar=yes,location=no,directories=yes,status=yes,menubar=yes,resizable=yes,scrollbars=yes\");</script>");
Response.Write 打开新窗口