public static void ShowMessage(System.Web.UI.Page page,string msg) { msg = msg.Replace("'", "\\'").Replace("\r\n", "\\r\\n").Replace("\"", @"\"""); //对单引号, 双引号,换行进行处理 以便在消息框中保留 Page.ClientScript.RegisterStartUpScript(page.GetType(),Guid.NewGuid().ToString(),"alert('"+msg+"')",true) }