0

我在做一个相对简单的任务时遇到了麻烦。我正在使用 jAlerts ( http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/ ),我知道它不再受支持,并尝试将按钮的文本更改为一个变量。

到目前为止,这里是 jAlerts 的开始代码,其中按钮被定义为字符串:

$.alerts = {

    // These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time

    verticalOffset: -75,                // vertical offset of the dialog from center screen, in pixels
    horizontalOffset: 0,                // horizontal offset of the dialog from center screen, in pixels/
    repositionOnResize: true,           // re-centers the dialog on window resize
    overlayOpacity: .01,                // transparency level of overlay
    overlayColor: '#FFF',               // base color of overlay
    draggable: true,                    // make the dialogs draggable (requires UI Draggables plugin)
    okButton: 'Ok',         // text for the OK button
    cancelButton: 'Cancel', // text for the Cancel button
            deleteButton: 'Delete', // text for the remove button
    dialogClass: null,                  // if specified, this class will be applied to all dialogs

我想要做的是用变量替换那些(在这种情况下,我使用的是一个大型 JS 数组):

$.alerts = {

    // These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time

    verticalOffset: -75,                // vertical offset of the dialog from center screen, in pixels
    horizontalOffset: 0,                // horizontal offset of the dialog from center screen, in pixels/
    repositionOnResize: true,           // re-centers the dialog on window resize
    overlayOpacity: .01,                // transparency level of overlay
    overlayColor: '#FFF',               // base color of overlay
    draggable: true,                    // make the dialogs draggable (requires UI Draggables plugin)
    okButton: property_dict['allDialog.OK.button.text'],         // text for the OK button
    cancelButton: property_dict['grid.Confirm.Delete.cancel'], // text for the Cancel button
            deleteButton: property_dict['grid.Confirm.Delete.remove'], // text for the remove button
    dialogClass: null,                  // if specified, this class will be applied to all dialogs

我在页面顶部看到,它说可以通过访问脚本中的 $.alerts.propertyName 来更改这些属性——问题是,似乎没有任何文档说明如何实际执行此操作。

那里有任何 jAlert 忍者可以帮助我吗:?

4

1 回答 1

4

你完全按照它所说的去做 - “在你的脚本中访问 $.alerts.propertyName”

更改确定按钮上的文本:

$.alerts.okButton = 'string literal or variable here';

更改取消按钮上的文本:

$.alerts.cancelButton = 'string literal or variable here';
于 2012-10-17T17:20:24.960 回答