[英]confirm box using javascript
如何在單擊導出按鈕之前獲取確認。如果是,則必須執行導出功能,否則,必須執行
if (confirm("Perform the export?"))
performTheExport();
我注意到您正在使用asp.net。 在Webform應用程序中,通常在回發之前需要確認對話框。
//the page
<asp:button id="mybutton" runat="server" Text="Click to submit" />
//in code behind
mybutton.Click += (sender, args)=>
{
SubmitData();
};
//if you need to confirm before submit, you can add:
mybutton.OnClientClick = "if (!confirm('are you sure?')) return;";
//another way
mybutton.Attributes["onclick"] = "if (!confirm('are you sure?')) return;";
如果要使用“自己的確認框”而不是confirm('are you sure?')
:
window.showMedalDialog('myConfirmPage.aspx')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.