0

下面显示的代码工作正常。我正在尝试将对话框部分(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" />&nbsp;&nbsp;&nbsp;&nbsp; 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" />&nbsp;&nbsp;&nbsp;&nbsp; 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');
4

1 回答 1

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" />&nbsp;&nbsp;&nbsp;&nbsp; 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');
于 2013-05-02T17:52:47.670 回答