.NET MessageBox 网页弹出消息框

方法一:
    #region Alert 弹出消息框
 /// <summary>   
    /// 弹出消息框   
    /// </summary>   
    /// <param name="msg">提示信息</param>   
    private void Alert(string msg)
    {
        string str = "<script language=\"javascript\">\n";
        str += "alert('" + msg + "');\n";
        str += "</script>";
        ClientScript.RegisterStartupScript(this.GetType(), "", str);
    }
    /// <summary>   
    /// 弹出消息框   
    /// </summary>   
    /// <param name="msg">提示信息</param>   
    /// <param name="url">URL或-1</param>   
    private void Alert(string msg, string url)
    {
        string str = "<script language=\"javascript\">\n";
        str += "alert('" + msg + "');\n";
        if (url == "-1")
        {
            str += "history.go(-1);\n";
        }
        else
        {
            str += "location.href=\"" + url + "\";\n";
        }
        str += "</script>";
        ClientScript.RegisterStartupScript(this.GetType(), "", str);
    }
#endregion

方法二:

 #region Alert 弹出消息框
/// <summary>   
/// 弹出消息框   
/// </summary>   
/// <param name="msg">提示信息</param>   
public static void Alert(string msg)   
{   
 string str = "<script language=\"javascript\">\n";   
 str += "alert('" + msg + "');\n";   
 str += "</script>";   
 System.Web.HttpContext.Current.Response.Write(str);   
 System.Web.HttpContext.Current.Response.End();   
}   
/// <summary>   
/// 弹出消息框   
/// </summary>   
/// <param name="msg">提示信息</param>   
/// <param name="url">URL或-1</param>   
public static void Alert(string msg, string url)   
{   
     string str = "<script language=\"javascript\">\n";   
     str += "alert('" + msg + "');\n";   
     if (url == "-1")   
     {   
         str += "history.go(-1);\n";   
     }   
     else   
     {   
         str += "location.href=\"" + url + "\";\n";   
     }   
     str += "</script>";   
     System.Web.HttpContext.Current.Response.Write(str);   
    System.Web.HttpContext.Current.Response.End();   
}  
#endregion

你可能感兴趣的:(message)