asp.net编程,网页无法弹出新窗口,js代码如下,请高手帮忙看看问题在哪里
stringstrScript="";strScript+="<scriptlanguage=\"javascript\">\n";strScript+="window....
string strScript = "";
strScript += "<script language=\"javascript\">\n";
strScript += "window.open('ImgDetail.aspx','新窗口,\"toolbar=yes;location=no;directories=yes;status=yes;menubar=yes;resizable=yes;scrollbars=yes\");\n";
strScript += "location.href='Default.aspx';";
strScript += "</script>";
bool b = ((Page)System.Web.HttpContext.Current.Handler).ClientScript.IsStartupScriptRegistered("PopUp");
if (!b)
{
((Page)System.Web.HttpContext.Current.Handler).ClientScript.RegisterStartupScript(this.GetType(), "PopUp", strScript,false);
}
}
用response.write本来是可以的,用会导致原窗口的刷新,影响体验 展开
strScript += "<script language=\"javascript\">\n";
strScript += "window.open('ImgDetail.aspx','新窗口,\"toolbar=yes;location=no;directories=yes;status=yes;menubar=yes;resizable=yes;scrollbars=yes\");\n";
strScript += "location.href='Default.aspx';";
strScript += "</script>";
bool b = ((Page)System.Web.HttpContext.Current.Handler).ClientScript.IsStartupScriptRegistered("PopUp");
if (!b)
{
((Page)System.Web.HttpContext.Current.Handler).ClientScript.RegisterStartupScript(this.GetType(), "PopUp", strScript,false);
}
}
用response.write本来是可以的,用会导致原窗口的刷新,影响体验 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询