Tag: 确认

jQuery确认无法在Chrome中运行

我正在尝试创建一个基本确认框,当用户点击链接时会提示用户进行简单的确认/取消。 这在FF和IE中运行良好,但Chrome似乎忽略了它。 任何人都可以看到为什么这可能不起作用? //Confirm Duplication $(“a[href*=duplicate]”).click(function(event){ var answer = confirm(“Duplicate?”) if(!answer){ event.preventDefault(); } }); 任何建议表示赞赏 谢谢。

在后面的代码中执行不同的代码确认确定并取消

我想在text_changed事件上有一个确认消息,并在ok上执行不同的代码集并取消。 帮帮我这些代码 function Confirm() { var confirm_value = document.createElement(“INPUT”); confirm_value.type = “hidden”; confirm_value.name = “confirm_value”; if (confirm(“Do you want to save data?”)) { confirm_value.value = “Yes”; } else { confirm_value.value = “No”; } document.forms[0].appendChild(confirm_value); } 代码背后 protected void TextBox1_TextChanged(object sender, EventArgs e) { // TextBox1.Attributes.Add(“OnClientClick”, “Confirm()”); string confirmValue = Request.Form[“confirm_value”]; if (confirmValue == “Yes”) { […]

使用模态表单确认(jQuery UI)从表中删除行?

我刚刚开始学习jQuery,如果我能学到它,它似乎充满机会。 我创建了一个包含删除按钮的最后一个单元格的表。 通过单击按钮,我想要显示一个确认对话框,如果用户接受该行将被删除。 取消只关闭确认对话框。 但我不知道如何做到这一点,即使在阅读了stackoverflow或其他网站中发布的许多示例之后。 我无法将这些改编为我的项目。 所以,我喜欢为这件事提供指导。 我的脚本现在看起来像这样: $(document).ready(function(){ $(“#dlgConfirm”).hide(); }); $(function() { $(“#dlgLink”).click(function(){ $( “#dlgConfirm” ).dialog({ resizable: false, height:140, modal: true, buttons: { “Delete selected toon”: function() { $( this ).dialog( “close” ); }, Cancel: function() { $( this ).dialog( “close” ); } } }); }); }); 一个html包含这些: Toons: Date Name Note Delete? 02.03.2011 […]

如何结合两个jQuery函数?

第一个function(可在http://nadiana.com/jquery-confirm-plugin找到): $(‘#confirm’).confirm( { msg: ‘You are about to delete gallery and all images related to that gallery. Are you sure?’, buttons: { separator: ‘ – ‘ } } ); 基本上是有/没有问题,如果你回答是,它继续进行。 第二function: $(document).ready(function() { $(‘#load’).hide(); }); $(function() { $(“.delete”).click(function() { $(‘#load’).fadeIn(); var commentContainer = $(this).parent(); var id = $(this).attr(“id”); var string = ‘id=’+ id ; $.ajax({ […]

如果确认为true,则调用另一个jQuery函数

如果确认为true,我正在尝试调用另一个jQuery函数,这里是代码: jQuery(“#adminForm_1”).submit(function () { var empty = false; jQuery(“:input”, “#adminForm_1”).each(function () { empty = (jQuery(this).val() == “”) ? true : empty; }); if (empty) { if (confirm(‘You have not filled out all of the fields, do you wish to continue?’)) { jQuery(“#adminForm_1”).validationEngine({ ajaxSubmit: true, ajaxSubmitFile: “/index.php?option=com_database&view=tripdetails&Itemid=12&client=1&task=save”, ajaxSubmitMessage: “Client Trip Details Saved”, inlineValidation: false, success: false, […]

重定向确认为真

我想这样做,以便用户点击链接,他们会得到一个确认框。 如果他们单击确定,他们会被发送到一个新的PHPfunction。 我试过了: function confirmReset() { var r = confirm(‘Are you sure?’); var url = window.location.pathname; var pathArray = url.split(‘/’); var host = pathArray[1]; var newHost = ‘/headquarters/designReset’; if (r == true) { window.location = host + newHost; //document.location.href = ‘/headquarters/designReset’; } else { alert(‘it didnt work’); } return false; }​ Firebug错误说: SyntaxError:非法字符 }一个€< 它说 […]

自定义JS使用jQuery.Deferred确认模态并根据按钮发出返回值

我是一个最近进入Javascript世界的java开发人员,所以如果我犯了一些愚蠢的错误或假设,请原谅我。 我试图将我们的原生浏览器/ js“确认”对话框转换为主要使用骨干框架开发的自定义模式。 目前,这些模态不支持“确认”类型function。 我认为主要问题是我的模态当前不是异步工作的。 我有一个方法,我打电话打开一个模态,我希望从通话中收到一个“真”或“假”值,这取决于用户点击的按钮。 但是,目前我的方法会在显示模态后立即返回,并且不会等待按钮单击。 模态系统支持每个按钮的单独回调,可以在调用“openPortletModal”方法时定义,如下所示。 但是,“confirmDiscard”方法返回一个未定义的值,而不会等待任何按钮调用。 我的问题是,是否可以暂停执行方法直到进行回调? 在研究的过程中,我确实发现了一些关于jQuery.Deferred的内容,但是我还没有找到一种明确的方法来利用它来获得我想要的function,而且我看到的任何示例都没有包含基于回调的不同返回值。 这是我的示例代码: confirmDiscard: function(context) { var deferred = new $.Deferred(); MyModal.openPortletModal(context, null, { views: [{ name: “auth”, title: “Confirmation”, renderResponseData: “This is a test”, //Message that modal renders buttons: [{ type: “FINISH”, label: “OK”, click: function() { console.log(“CLICKED OK”); deferred.resolve(“true”); //this is ultimately what I’d […]

jQuery / Javascript确认两次出现

出于一些奇怪的原因,我得到了两次确认框。 这是我的代码: $(“.DeleteComment”).live(“click”, function(){ var CommentID = $(this).attr(“rel”); var confirm if (!confirm(‘Are you sure you want to permanently delete this comment?’)){ return false; }else{ $(this).html(“loading”).css(“color”, “#999”); //AJAX HERE return false; } });

在保留回调的同时覆盖Javascript Confirm()

至此,我想在jQuery插件中覆盖标准的js confirm()函数。 我已经想出了如何使用下面的简单function布局。 function confirm(opts) { //code } 现在,我想做的是在上面的confirm函数中调用另一个函数,就像这样…… function confirm(opts) { openModal(opts); } openModal函数将打开一个带有消息和所需按钮的自定义模式窗口。 这些按钮都是 ,其id为submit或cancel 。 submit返回true, cancel返回false。 但是现在,如何根据点击的按钮返回true或false? 例如… $(‘#openModal’).live(‘click’, function() { var opts = { title:’Modal Title’, message:’This is a modal!’ }; var resp = confirm(opts); if(resp) // user clicked else // user clicked }); 希望你明白我的意思。

Jquery UI对话框代替javascript确认

我有一堆validationjavascript进程与确认。 我想使用jquery ui对话框,但我需要在其余的validation过程中返回true。 例如: var where_to_coupon = confirm(pm_info_msg_013); if (where_to_coupon== true) { doSubmit=true; return doSubmit; 所以我需要一个用UI对话框替换确认的函数,拉取消息字符串(pm_info_msg_013),并使用我自己的按钮或UI按钮为validation过程返回true。 不知道从哪里开始。 救命?