确认框上的是或否按钮
Yes or No buttons on confirmation box
下面的代码在 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>
您无法使用 confirm
执行此操作。无法自定义本机 alert
/confirm
/etc 对话框的按钮。
您可以创建一个基于 DOM 的对话框,然后根据您的喜好自定义元素。
下面的代码在 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>
您无法使用 confirm
执行此操作。无法自定义本机 alert
/confirm
/etc 对话框的按钮。
您可以创建一个基于 DOM 的对话框,然后根据您的喜好自定义元素。