【问题标题】:how can i get Response of OK button message box in client page如何在客户端页面中获得 OK 按钮消息框的响应
【发布时间】:2011-09-17 05:50:43
【问题描述】:

如何在客户端页面中获得 OK 按钮消息框的响应。

ClientScript.RegisterStartupScript(this.GetType(), "My alert", "alert('" 你的时间已经结束了"');", true);

此代码以简单的方式运行,但没有得到任何响应。

【问题讨论】:

    标签: javascript asp.net


    【解决方案1】:

    您可以在下一行直接开始您的进一步活动。单击确定按钮后,它将返回到您的下一行。

    //你的代码放在这里... //例如:-

         ClientScript.RegisterStartupScript(this.GetType(), "My alert", "alert('" Your time has been finished "');", true);
        System.Text.StringBuilder sbs = new System.Text.StringBuilder();
        sbs.Append("<script language='javascript'>");
        sbs.Append("window.location = 'http://www.google.com/'");//or whatever you want:-
        sbs.Append("</script>");
        Type tr = this.GetType();
        ClientScript.RegisterClientScriptBlock(tr, "PopupScript2", sbs.ToString());
    

    【讨论】:

    • 但我想在按下确定按钮后重定向页面是否可以在 javascript sbs.Append("Response.Redirect("Home.aspx")");它不工作..现在该怎么办..
    • ClientScript.RegisterStartupScript(this.GetType(), "My alert", "alert('" 你的时间已经结束了"');", true); System.Text.StringBuilder sds = new System.Text.StringBuilder(); sds.Append("
    • 这段代码对我来说很好用。否则您可以查看此链接以获得更多帮助:stackoverflow.com/questions/3695351/…
    猜你喜欢
    • 2018-04-23
    • 1970-01-01
    • 2010-12-02
    • 1970-01-01
    • 1970-01-01
    • 2017-05-29
    • 2021-01-18
    • 1970-01-01
    相关资源
    最近更新 更多