【问题标题】:Yes or No buttons on confirmation box [duplicate]确认框上的是或否按钮[重复]
【发布时间】:2017-08-02 05:07:39
【问题描述】:

以下代码在 Asp.Net 上运行带有 Javascript 的确认框。
我需要更改按钮文本。如何在此消息框中使用是或否按钮?
谢谢。

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Confirmation</title>
    <script type="text/javascript">    
   function ConfirmOnDelete() {
    if (confirm("Some question") == true)
        return true;
    else
        return false;
   }
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return ConfirmOnDelete();" OnClick="Button1_Click"/>
    </div>
    </form>
</body>
</html>

【问题讨论】:

    标签: jquery asp.net messagebox confirmation


    【解决方案1】:

    confirm 无法做到这一点。无法自定义原生alert/confirm/etc 对话框的按钮。

    您可以改为创建一个基于 DOM 的对话框,并根据自己的喜好自定义元素。

    【讨论】:

      猜你喜欢
      • 2012-05-20
      • 2012-02-09
      • 1970-01-01
      • 2012-03-16
      • 2015-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多