下面显示的代码工作正常。我试图将对话框部分(GBBSO.cnst.ddlog.dialog行)移动到GBBSO.cnst代码块中,并且我遇到了各种错误 - 语法,函数未定义等等。这可能吗?
if (GBBSO == null || typeof (GBBSO) != "object") { var GBBSO = new Object(); }
GBBSO.cnst = {
datePickerOpt1: {
dateFormat: 'dd-M-yy',
showOn: 'button',
buttonImage: 'Styles/Images/Calendar_scheduleHS.png',
buttonImageOnly: true,
buttonText: 'Select a date',
showButtonPanel: true,
changeMonth: 'true',
changeYear: 'true',
beforeShow: function (input) { GBBSO.dpClearButton(input); },
onChangeMonthYear: function (yy, mm, inst) { GBBSO.dpClearButton(inst.input); }
},
ddlog: jQuery('<div><span><img src="Global_Template_Files/Images/loading.gif" /> Communicating with the server....</span></div>')
}
GBBSO.cnst.ddlog.dialog({ autoOpen: false, resizable: false, modal: true, width: 400, height: 100, closeOnEscape: false, show: 'drop', hide: 'drop',
open: function (event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
GBBSO.cnst.ddlog.dialog('open');
下面显示的代码不起作用。我在开放时收到“预期功能”错误。
GBBSO.cnst = {
datePickerOpt1: {
dateFormat: 'dd-M-yy',
showOn: 'button',
buttonImage: 'Styles/Images/Calendar_scheduleHS.png',
buttonImageOnly: true,
buttonText: 'Select a date',
showButtonPanel: true,
changeMonth: 'true',
changeYear: 'true',
beforeShow: function (input) { GBBSO.dpClearButton(input); },
onChangeMonthYear: function (yy, mm, inst) { GBBSO.dpClearButton(inst.input); }
},
ddlog: {
html: jQuery('<div><span><img src="Global_Template_Files/Images/loading.gif" /> Communicating with the server....</span></div>'),
dialog: { autoOpen: false, resizable: false, modal: true, width: 400, height: 100, closeOnEscape: false, show: 'drop', hide: 'drop',
open: function (event, ui) { $(".ui-dialog-titlebar-close").hide(); }
}
}
}
GBBSO.cnst.ddlog.dialog(GBBSO.cnst.ddlog.dialog);
GBBSO.cnst.ddlog.dialog('open');
答案 0 :(得分:0)
如果正确设置了对话框功能,则第二个示例有效。修改了第二个例子来修复代码并使'对话'不那么混乱。 (谢谢SpYk3HH)
if (GBBSO == null || typeof (GBBSO) != "object") { var GBBSO = new Object(); }
GBBSO.cnst = {
datePickerOpt1: {
dateFormat: 'dd-M-yy',
showOn: 'button',
buttonImage: 'Styles/Images/Calendar_scheduleHS.png',
buttonImageOnly: true,
buttonText: 'Select a date',
showButtonPanel: true,
changeMonth: 'true',
changeYear: 'true',
beforeShow: function (input) { GBBSO.dpClearButton(input); },
onChangeMonthYear: function (yy, mm, inst) { GBBSO.dpClearButton(inst.input); }
},
ddlog: {
html:jQuery('<div><span><img src="Global_Template_Files/Images/loading.gif" /> Communicating with the server....</span></div>'),
dialogAttrs: { autoOpen: false, resizable: false, modal: true, width: 400, height: 100, closeOnEscape: false, show: 'drop', hide: 'drop',
open: function (event, ui) { $(".ui-dialog-titlebar-close").hide(); }
}
}
}
GBBSO.cnst.ddlog.html.dialog(GBBSO.cnst.ddlog.dialogAttrs);
GBBSO.cnst.ddlog.html.dialog('open');