输出带有是/否的对话框,实现效果是:点击是,继续添加内容,点击否,返回自己定义的页面
/// <summary>
/// 拥有'确定'/'取消'按钮的对话框
/// </summary>
/// <param name="strText">对话框的文本信息</param>
/// <param name="strURL">重新定向的地址</param>
public static void MessageBoxYesNo(string strText, string strURL)
{
HttpContext.Current.Response.Write("<script language='javascript'>var value;");
HttpContext.Current.Response.Write("value=window.confirm('" + strText + "');");
HttpContext.Current.Response.Write("if (value==true){window.location='" + strURL + "';}</script>");
HttpContext.Current.Response.Write("</script>");
}
/// <summary>
/// 拥有'确定'/'取消'按钮的对话框
/// </summary>
/// <param name="strText">对话框的文本信息</param>
/// <param name="strURL">重新定向的地址</param>
public static void MessageBoxYesNo(string strText, string strURL)
{
HttpContext.Current.Response.Write("<script language='javascript'>var value;");
HttpContext.Current.Response.Write("value=window.confirm('" + strText + "');");
HttpContext.Current.Response.Write("if (value==true){window.location='" + strURL + "';}</script>");
HttpContext.Current.Response.Write("</script>");
}