c# 网页对话框如何编辑按钮事件?

来源:百度知道 编辑:UC知道 时间:2024/05/05 02:38:48
我定义了一个类:
public class CShowMsg
{
public static void Show(System.Web.UI.Page pg, string msg)
{
string info = "<script>alert('" + msg + "');</script>";
pg.Response.Write(info);
}
}
之后,在程序中写入:
CShowMsg.Show(this, @"密码错误!\r");
弹出了一个带“确定”按钮的对话框
请问,应该怎样对网页对话框上的“确定”按钮写入事件,使得点击“确定”按钮之后链接另一个网页

希望提供详细的代码,谢谢!

给你的方法再加一个参数.

public class CShowMsg
{
public static void Show(System.Web.UI.Page pg, string msg,string url)
{
string info = "<script>alert('" + msg + "');location.href='"+url+"';</script>";
pg.Response.Write(info);
}
}

调用的时候:CShowMsg.Show(this, @"密码错误!\r","login.aspx");