后台使用JS,或调用前台的js

来源:互联网 发布:新浪数据库 编辑:程序博客网 时间:2024/06/10 21:05
#region
                string js = "<script language=javascript>alert('{0}');window.location.replace('{1}')</script>";
                string message = "";
                if (action == "edit")
                {
                    message = "修改成功!";
                }
                else message = "新增成功!";
                HttpContext.Current.Response.Write(string.Format(js, message, "dishes_list.aspx"));

                #endregion


#region
                string js = @"<script language=javascript>VMsg.AlertSuccess('{0}');window.location.replace('{1}')</script>";
                string message = "";
                if (action == "edit")
                {
                    message = "修改成功!";
                }
                else message = "新增成功!";
                ClientScript.RegisterStartupScript(this.GetType(), "key", string.Format(js, message, "dishes_list.aspx"));
                #endregion


注意区别哈!