aspx.cs中用Response.Write打印alert
很简单的一个问题,我要在catch语句块中要通过Response.Write方法打印出捕获的异常:
catch (Exception exp)
{
string expMsg = exp.ToString();
Response.Write("<Script> alert(...) </script> ");
}
里面的Script语句应该怎么写呢?
------解决方案--------------------
ClientScript.RegisterStartupScript(this.GetType(), "message", "<script language='javascript'>alert('" + ex.Message+ "');</script>");
------解决方案--------------------
Response.Write("<Script> alert('" + exp.ToString() + "'); </script> ");
改成Response.Write("<script> alert('" + exp.ToString() + "'); </script> ");
js区分大小写