我正在尝试添加新行 Javascript 警报消息。我尝试了“\n”和“Environment.NewLine”。我收到未终止的字符串常量错误。你能告诉我可能是什么问题吗?我很感激任何帮助。我也试过\r\n。
string msg = "Your session will expire in 10 minutes. \n Please save your work to avoid this.";
if (!this.ClientScript.IsStartupScriptRegistered(ID))
this.ClientScript.RegisterStartupScript(GetType(), ID, String.Format("<script language=JavaScript>setTimeout(\'alert(\"{1}\");\',{0}*1000);</script>", sTime, msg));