Jquery确认窗口不工作,取消按钮点击
Jquery confirm window not working on cancel button click
我有以下代码在javascript中打开确认对话框与是和否选项,但我在打开确认对话框面临一些问题。
function ConfirmDialog(obj, title, dialogText) {
if (!dialogConfirmed) {
$('body').append(String.Format("<div id='dialog' title='{0}'><p>{1}</p></div>",
title, dialogText));
$('#dialog').dialog
({
height: 150,
modal: true,
resizable: false,
draggable: false,
close: function (event, ui) { $('body').find('#dialog').remove(); },
buttons:
{
'Yes': function () {
$(this).dialog('close');
dialogConfirmed = true;
GetRadWindow().close();
if (obj) obj.click();
},
'No': function () {
$(this).dialog('close');
}
}
});
}
return dialogConfirmed;
}
这是我在aspx页面的代码
<script type="text/javascript" src="Scripts/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui-1.8.2.custom.min.js"></script>
<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
<input id="Button2" type="button" value="Cancel" onclick="return ConfirmDialog(this, 'Confirmation', 'Are you sure want to close the window?');" />
可能是你在你的页面1.4.1和1.4.2包含两个版本的jquery ?请修改一下,看看。
字符串。javascript格式?这是你写的方法吗?
这段代码到达第3行,在JavaScript中看到String.Format
并在那里停止执行。
有没有字符串。jQuery/JavaScript格式。如果你特别注意使用String。用JavaScript格式化,自己创建一个。
String.prototype.format = function() {
var formatted = this;
for (var i = 0; i < arguments.length; i++) {
var regexp = new RegExp('''{'+i+'''}', 'gi');
formatted = formatted.replace(regexp, arguments[i]);
}
return formatted;
};
像
一样使用$('body').append("<div id='dialog' title='{0}'><p>{1}</p></div>".format(title, dialogText));
相关文章:
- javascript提示-如何以阿拉伯语文本显示确定/取消按钮
- 选择文件(表单提交)后无法单击“取消”按钮
- 使用 Jquery 使取消按钮绕过自定义验证
- 引导程序3-下拉菜单项中的取消按钮
- 取消按钮不适用于确认窗口
- 没有取消按钮的Javascript提示框
- blueimpjquery文件上传如何检测按下取消按钮
- 将编辑按钮与保存和取消按钮切换
- 如何使javascript提示框取消按钮什么都不做
- 取消按钮自动回发 - 客户端单击实现的细节
- JavaScript 提示框:如何验证取消按钮 (null)
- 单击取消按钮后如何删除数据库行
- 当我单击“取消”按钮时,它不会删除数据库行
- 如何防止在单击确认警报框中的取消按钮后刷新页面
- 无法通过单击取消按钮停止 ajax 调用
- 浏览器确认关闭:取消按钮也会关闭浏览器
- 管理“取消”按钮的方法
- 蛋糕2,返回/取消按钮转到上一页
- 如何通过单击“取消”按钮取消文件上传
- 捕获 Java 小程序取消按钮