开发者

confirm box using javascript

how to get conf开发者_如何学运维irmation before a export button is cliked.if yes then then export function has to be done if no it should not be done


confirm box?

if (confirm("Perform the export?"))
  performTheExport();


I noticed that you are using asp.net. In webform applications, often we need a confirm dialog before doing postback.

//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;";

If you want to use your 'own confirm box' instead of confirm('are you sure?'):

window.showMedalDialog('myConfirmPage.aspx')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜