Javascript确认对话框 [英] Javascript Confirm Dialog box

查看:128
本文介绍了Javascript确认对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起我的英语可怜,首先....我有一个gridview,我有删除选项的按钮删除一个数字,因为我在javascript中保持弹出框,在该javascript函数,如果我点击事件正在处理的确定或取消按钮我需要限制事件,如果我们点击取消按钮,请帮我解决这个问题

sorry for my poor english first of all,....I have a gridview in that i have button for delete option to delete a number, for that i kept pop up box in javascript, in that javascript function if i click the ok or cancel button the event is handling i need to restrict the event if we click the cancel button, please help me out from this issue

推荐答案

我假设你是使用ASP.NET。下面是gridview中按钮的代码:

I assume you are using ASP.NET. Below is the code of button inside gridview:
<asp:button id="btnDelete" runat="server" onclientclick="return confirmation();"/>



Javascript代码将如下所示:


Javascript code will go like this:

function confirmation() {
  if (confirm("Are you sure you want to delete this record?"))
      return true;
  else 
      return false;
}



问候..


Regards..


<ItemTemplate>
                                                                    <asp:Button ID="LinkButton1" runat="server" BorderColor="White"  BorderStyle="none" CausesValidation="false" CommandArgument='<%# Eval("CLI") %>'  CommandName="delete"   Text ="Delete" OnClientClick='<%# String.Format("javascript:DeleteCli(""{0}"");", Eval("CLI"))%>'/>
                                                                    </ItemTemplate>










function DeleteCli(id)
 {
       // window.open("JHProducts.asp?ID=" + id );
      var dlt = confirm("Are you sure want to delete this number?"+ id,null,"status=yes,resizable=no,left=350,top=250,width=350,height=250");
       //var dlt = confirm("Are you sure want to delete this number?");
}





这是我的代码



this is my code


这篇关于Javascript确认对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆