gpt4 book ai didi

javascript - 使用 jAlerts 动态更改按钮文本

转载 作者:行者123 更新时间:2023-11-28 16:11:11 24 4
gpt4 key购买 nike

我在完成一项相对简单的任务时遇到了困难。我正在使用 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 忍者能帮我吗:?

最佳答案

您完全按照它所说的操作 - “在脚本中访问 $.alerts.propertyName”

更改“确定”按钮上的文本:

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

更改取消按钮上的文本:

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

关于javascript - 使用 jAlerts 动态更改按钮文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12939697/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com