//直接调用WebMessageBox方法 #region 弹出消息对话框 /// <summary> /// 弹出消息对话框 /// </summary> /// <param name="page">要弹出对话框的Page类</param> /// <param name="strMsg">对话框中提示的内容</param> public static void WebMessageBox(Page page, string strMsg) { ScriptManager.RegisterClientScriptBlock(page, typeof(Page), "", "alert(‘" + strMsg + "‘);", true); } #endregion #region 弹出消息对话框并跳转 /// <summary> /// 弹出消息对话框并跳转 /// </summary> /// <param name="page">要弹出消息对话框的Page类</param> /// <param name="strMsg">对话框中提示的内容</param> /// <param name="pageURL">点击对话框中的确定后转向页面的URL,必须是相对路径用(../)来表示</param> public static void WebMessageBox(Page page, string strMsg, string pageURL) { ScriptManager.RegisterClientScriptBlock(page, typeof(Page), "", "alert(‘" + strMsg + "‘);location.href=‘" + pageURL + "‘;", true); } #endregion public static void ShowConfirm( string strMsg, string strUrl_Yes, string strUrl_No) { System.Web.HttpContext.Current.Response.Write( " <Script Language=‘JavaScript‘>if ( window.confirm(‘ " + strMsg + " ‘)) { window.location.href=‘ " + strUrl_Yes + " ‘ } else {window.location.href=‘ " + strUrl_No + " ‘ };</script> " ); }
时间: 2024-11-03 13:31:34