Javascript确认框,是/否,它显示确认框,但从不等待使用点击是。它会自动提交表单
Javascript代码:Javascript确认框,是/否,它显示确认框,但从不等待使用点击是。它会自动提交表单,javascript,Javascript,Javascript代码: if (s12.value < s10.value) { $('<div></div>').appendTo('body') .html('<div><h6>' + "Out Time is less than In Time. Is that ok??" + '</h6></div>') .dialog({
if (s12.value < s10.value) {
$('<div></div>').appendTo('body')
.html('<div><h6>' + "Out Time is less than In Time. Is that ok??" + '</h6></div>')
.dialog({
modal: true,
title: 'Confirmation',
zIndex: 10000,
autoOpen: true,
width: 'auto',
resizable: true,
buttons: {
Yes: function () {
if (s10.value < s14.value || s14.value < s12.value) {
alertDialog("Time is not between out time and in time.");
} else {
$("#<%=Button1.ClientID%>").submit();
}
$(this).dialog("close");
},
No: function () {
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).remove();
}
});
< script >
function alertDialog(message) {
$('<div></div>').appendTo('body')
.html('<div><h6>' + message + '</h6></div>')
.dialog({
modal: true,
title: 'Errors',
zIndex: 10000,
autoOpen: true,
width: 'auto',
resizable: true,
buttons: {
Ok: function () {
$(this).dialog("close");
},
},
close: function (event, ui) {
$(this).remove();
}
});
}; < /script>
if(s12.value
函数警报对话框(消息){
$('').appendTo('正文')
.html(“”+消息+“”)
.对话({
莫代尔:是的,
标题:“错误”,
zIndex:10000,
自动打开:对,
宽度:“自动”,
可调整大小:正确,
按钮:{
Ok:函数(){
$(此).dialog(“关闭”);
},
},
关闭:功能(事件、用户界面){
$(this.remove();
}
});
};
条件1:如果(s12.value
则显示确认框,说明“超时小于及时,是否正常?”
如果用户选择是,则条件2:如果(s10.value
则显示警报框
否则请提交表格
问题:它能够显示确认框,但从不等待用户点击是/否,它会自动提交表单
请提供帮助。提前感谢。您应该在不打开对话框的情况下创建对话框
var dialog_var = $('<div></div>').appendTo('body')
.html('<div><h6>' + message + '</h6></div>')
.dialog({
modal: true, title: 'Errors', zIndex: 10000, autoOpen: true,
width: 'auto', resizable: true,
buttons: {
Ok: function () {
$(this).dialog("close");
},
function alertDialog(message) {
$(dialog_var).dialog("open");
var对话框\u var=$('').appendTo('body'))
.html(“”+消息+“”)
.对话({
模态:真,标题:“错误”,zIndex:10000,自动打开:真,
宽度:“自动”,可调整大小:真,
按钮:{
Ok:函数(){
$(此).dialog(“关闭”);
},
函数警报对话框(消息){
$(dialog_var).dialog(“打开”);
如果您正确缩进代码,并告诉我们所有的s**.value
内容是什么,也许我们可以提供帮助?您是如何运行此代码的?如果它是从表单的submit
处理程序运行的,则需要从该处理程序返回false以防止默认表单提交,并将Yes
代码置于模式c中所有form.submit()
.s10.value-->患者住院时间s12.value-->患者门诊时间s14.value-->手术时间(介于患者住院时间和门诊时间之间)示例:如果患者住院时间-->22:00患者门诊时间:5:00,则手术时间应介于22:00和5:00之间,如3:00