不推荐使用Response.Write("........");这种方式
可以使用下面语句打开一个窗体
public static void WindowOpen( Page page,string strUrl )
...{
string strScript;
strScript = "<script language=javascript>";
strScript += "var intHeight = 600;";
strScript += "var intWidth = window.screen.width-150; ";
strScript += "var strFeature = 'height=' + intHeight + ',width=' + intWidth +',left=80,top=80,toolbar=no,status=no,menubar=no,location=no,resizable=yes,scrollbars=yes ';";
strUrl = "window.open('" + strUrl + "','_blank', strFeature,true);";
strScript += strUrl;
strScript += "</script>";
if(!page.IsStartupScriptRegistered("windowOpen"))
page.RegisterStartupScript("windowOpen",strScript);
}
本文介绍了一种在 ASP.NET 中打开新窗口的方法,通过注册StartupScript实现自定义弹窗大小位置,替代了传统的 Response.Write 方式。
338

被折叠的 条评论
为什么被折叠?



