点击完成后。我没有得到自定义确认框,是没有选项。
>>> print(df['test'])
0 True
1 True
2 False
3 True
4 True
5 False
6 True
7 False
8 True
9 True
10 True
11 True
12 False
13 False
14 True
>>>print(seq_len)
[(True, 2), (False, 1), (True, 2), (False, 1), (True, 1), (False, 1), (True, 4), (False, 2), (True, 1)]
>>>print(true_seq_count)
Counter({1: 2, 2: 2, 4: 1})
我进入函数doConfirm()的警报。但是确认窗口没有到来。请帮助我。
答案 0 :(得分:0)
$("#button").click(function{
$('<div></div>').appendTo('body')
.html('<div><h6>Are you sure?</h6></div>')
.dialog({
title: 'Conform message',
modal: true,
zIndex: 99,
autoOpen: false,
width: 'auto',
resizable: false,
buttons: {
Yes: function () {
//some text
$(this).dialog("close");
},
No: function () {
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).remove();
}
});
});
答案 1 :(得分:0)
尝试以下代码 -
function doConfirm(msg, yesFn, noFn) {
alert("Inside");
var confirmBox = $("#confirmBox");
alert("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();
}
function isAnchorTagClicked(){
alert("yes");
doConfirm("Are you sure?", function yes()
{
alert("Yes Clicked");
}, function no()
{
// do nothing
});
}
body { font-family: sans-serif; }
#confirmBox
{
display: none;
background-color: #eee;
border-radius: 5px;
border: 1px solid #aaa;
position: fixed;
width: 300px;
left: 50%;
margin-left: -150px;
padding: 6px 8px 8px;
box-sizing: border-box;
text-align: center;
}
#confirmBox .button {
background-color: #ccc;
display: inline-block;
border-radius: 3px;
border: 1px solid #aaa;
padding: 2px;
text-align: center;
width: 80px;
cursor: pointer;
}
#confirmBox .button:hover
{
background-color: #ddd;
}
#confirmBox .message
{
text-align: left;
margin-bottom: 8px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div id="confirmBox">
<div class="message"></div>
<span class="button yes">Yes</span>
<span class="button no">No</span>
</div>
<button onclick="isAnchorTagClicked()">Done</button>
答案 2 :(得分:0)
当我修复自关闭脚本标记并删除对jQuery的重复引用时,您的代码对我来说很好。
<script language="javascript" src="scripts/jquery-latest.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"/>
所以这两行才变成
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
你的代码运行了。
function doConfirm(msg, yesFn, noFn) {
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();
}
function isAnchorTagClicked() {
doConfirm("Are you sure?", function yes() {
alert("Yes Clicked");
}, function no() {
// do nothing
});
}
#confirmBox { display : none; }
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<div id="confirmBox">
<div class="message"></div>
<span class="button yes">Yes</span>
<span class="button no">No</span>
</div>
<button onclick="isAnchorTagClicked()">Done</button>