asp.net弹出对话的封装
-
-
-
-
-
- public static void MsgBox(string thismsg, Page curPage)
- {
- StringBuilder sb = new StringBuilder();
- sb.Append("<script type='text/javascript'>");
- string script = "window.alert('" + thismsg + "');";
- sb.Append(script);
- sb.Append("</script>");
- Literal literal = new Literal();
- literal.Text = sb.ToString();
- curPage.Form.Controls.Add(literal);
- }
-
-
-
-
-
-
- public static void MsgBox1(string _Msg, string URL)
- {
- string StrScript;
- StrScript = ("<script language=javascript>");
- StrScript += "var retValue=window.confirm('" + _Msg + "');" + "if(retValue){window.location='" + URL + "';}";
- StrScript += ("</script>");
- System.Web.HttpContext.Current.Response.Write(StrScript);
- }
-
-
-
-
-
-
- public static void MsgBox2(string _Msg, string URL)
- {
- string StrScript;
- StrScript = ("<script language=javascript>");
- StrScript += ("alert('" + _Msg + "');");
- StrScript += ("window.location='" + URL + "';");
- StrScript += ("</script>");
- System.Web.HttpContext.Current.Response.Write(StrScript);
- }
-
-
-
-
-
-
- public static void MyMsgBox2(string _Msg, string URL)
- {
- string StrScript;
- StrScript = ("<script language=javascript>");
- StrScript += ("alert('" + _Msg + "');");
- StrScript += ("window.parent.location.href='"+URL+"';");
- StrScript += ("</script>");
- System.Web.HttpContext.Current.Response.Write(StrScript);
- }
-
-
-
-
-
- public static void MsgBox3(string _Msg)
- {
- string StrScript;
- StrScript = ("<script language=javascript>");
- StrScript += ("alert('" + _Msg + "');");
- StrScript += ("window.close();");
- StrScript += ("</script>");
- System.Web.HttpContext.Current.Response.Write(StrScript);
- }
原文地址:https://www.cnblogs.com/dingdingmao/p/3146592.html