後臺使用JS,或調用前臺的js

#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


注意區別哈!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章