Javascript弹出对话框并跳转方法
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
PopUpManager("弹出的对话框", "http://www.baidu.com");
}
/// <summary>
/// Javascript弹出对话框并跳转页面
/// </summary>
/// <param name="_Msg">要弹出对画框中的内容</param>
/// <param name="URL">要跳转的URL</param>
public void PopUpManager(string body, string URL)
{
string Script;
Script = ("<script language=javascript>");
Script += "var retValue=window.confirm('" + body + "');" + "if(retValue){window.location='" + URL + "';}";
Script += ("</script>");
System.Web.HttpContext.Current.Response.Write(Script);
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
PopUpManager("弹出的对话框", "http://www.baidu.com");
}
/// <summary>
/// Javascript弹出对话框并跳转页面
/// </summary>
/// <param name="_Msg">要弹出对画框中的内容</param>
/// <param name="URL">要跳转的URL</param>
public void PopUpManager(string body, string URL)
{
string Script;
Script = ("<script language=javascript>");
Script += "var retValue=window.confirm('" + body + "');" + "if(retValue){window.location='" + URL + "';}";
Script += ("</script>");
System.Web.HttpContext.Current.Response.Write(Script);
}
}