我的确认框是没有事件不起作用? [英] my confirm box yes no event is not working ?
本文介绍了我的确认框是没有事件不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在调用这个函数,但是在我点击保存的确认框上,没有任何反应。
on btnSave I am calling this function, but on confirmnation box when i click on save,nothing happens.
function ValidateStatus() {
document.getElementById('<%=hdnStatus.ClientID %>').value = "";
var sta = document.getElementById('<%=ddlStatus.ClientID %>').options[document.getElementById('<%=ddlStatus.ClientID %>').selectedIndex].text;
if (sta == "Live") {
if (document.getElementById('<%=hdnAddedBy.ClientID %>').value == document.getElementById('<%=hdnAddedFor.ClientID %>').value) {
if (doConfirm("Once this objective is saved as live it will be visible to all on the company home page.",function yes() {
return true;
}, function no() {
return false;
}) == true) {
return true;
//document.getElementById('<%=hdnStatus.ClientID %>').value = "live";
}
else {
return false;
//document.getElementById('<%=hdnStatus.ClientID %>').value = "draft";
}
}
}
}
function doConfirm(msg, yesFn, noFn) {
debugger;
var confirmBox = $("#confirmBox");
confirmBox.find(".message").text(msg);
confirmBox.find(".yes,.no").unbind().click(function () {
confirmBox.hide();
});
confirmBox.find(".yes").click(yesFn);
confirmBox.find(".no").click(noFn);
confirmBox.show();
}
<div id="confirmBox">
<div class="message"></div>
<span id="saveme" class="button yes" runat="server" önclick="javascript:document.getElementById('ContentPlaceHolder1_btnSave').click();">Save
<span id="updateme" runat="server" class="button yes" önclick="javascript:document.getElementById('ContentPlaceHolder1_btnSave').click();">Update
<span class="button no">Cancel</span>
</div>
推荐答案
( #confirmBox);
confirmBox.find( 。message)。text(msg);
confirmBox.find( 。yes,.no)。unbind()。click (function(){
confirmBox.hide();
});
confirmBox.find( 。yes)。click(yesFn);
confirmBox.find( 。no)。click(noFn);
confirmBox.show();
}
("#confirmBox"); confirmBox.find(".message").text(msg); confirmBox.find(".yes,.no").unbind().click(function () { confirmBox.hide(); }); confirmBox.find(".yes").click(yesFn); confirmBox.find(".no").click(noFn); confirmBox.show(); }
<div id="confirmBox">
<div class="message"></div>
<span id="saveme" class="button yes" runat="server" önclick="javascript:document.getElementById('ContentPlaceHolder1_btnSave').click();">Save
<span id="updateme" runat="server" class="button yes" önclick="javascript:document.getElementById('ContentPlaceHolder1_btnSave').click();">Update
<span class="button no">Cancel</span>
</div>
请尝试以下操作。
Try like below.
function doConfirm(msg, yesFn, noFn) {
debugger;
var confirmBox =
( #confirmBox);
confirmBox.find( 。message)。text(msg) ;
confirmBox.find( 。yes,.no)。unbind (' click)。bind(' click',function(){
confirmBox.hide();
});
confirmBox.find( 。yes)。unbind(' click')。bind(' click',function(yesFn));
confirmBox.find( 。no)。unbind(' click')。bind(' click',function(noFn));
confirmBox.show();
}
("#confirmBox"); confirmBox.find(".message").text(msg); confirmBox.find(".yes,.no").unbind('click').bind('click', function (){ confirmBox.hide(); }); confirmBox.find(".yes").unbind('click').bind('click', function (yesFn)); confirmBox.find(".no").unbind('click').bind('click', function (noFn)); confirmBox.show(); }
我希望这会对你有所帮助。
I hope this will help to you.
这篇关于我的确认框是没有事件不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文