private void ShowMessageBox(string strMessaage) //输出信息 { Page.ClientScript.RegisterStartupScript(this.GetType(), " ", string.Format("<script> alert(\"{0}\")</script> ", strMessaage.Replace("\"", "\\\" "))); } private void ShowMessageBoxURL(string err, string url) //输出信息并跳转 { System.Text.StringBuilder builder = new System.Text.StringBuilder(); builder.Append(" <script language=\"javascript\">"); builder.Append("alert(\"" + err + "\");"); if (!String.IsNullOrEmpty(url)) builder.Append("location=‘" + url + "‘;"); else builder.Append("history.go(-1);"); builder.Append(" </script>"); HttpContext.Current.Response.Write(builder.ToString()); HttpContext.Current.Response.End(); }
原文:http://www.cnblogs.com/cmfshcj/p/4995966.html