在道场中确认对话框
confirm dialog in dojo
如何在道场中创建确认对话框?我想在带有道场对话框的按钮单击时出现一个确定的取消对话框(没有javascript确认对话框)。到目前为止,我只能在单击事件上显示一个对话框。这是我的代码:
<script type="text/javascript">
dojo.require("dijit.form.Button");
dojo.require("dijit.Dialog");
var secondDlg;
dojo.ready(function(){
// create the dialog:
secondDlg = new dijit.Dialog({
title: "Programmatic Dialog Creation",
style: "width: 300px",
draggable:false
});
});
showDialogTwo = function(){
// set the content of the dialog:
secondDlg.set("content", "Hey, I wasn't there before, I was added at " + new Date() + "!");
secondDlg.show();
}
</script>
</head>
<body class="claro" style="margin-right:10px;">
<button id="buttonTwo" data-dojo-type="dijit.form.Button" data-dojo-props="onClick:showDialogTwo" type="button">Show me!</button>
</body>
如何使此"正常取消"对话框?
<script type="dojo/method" event="onClick">
var dialog = new dijit.Dialog({
title: "Delete Switch Type",
style: "width: 400px",
content : "Do you really want to delete ?????<br>"
});
//Creating div element inside dialog
var div = dojo.create('div', {}, dialog.containerNode);
dojo.style(dojo.byId(div), "float", "left");
var noBtn = new dijit.form.Button({
label: "Cancel",
onClick: function(){
dialog.hide();
dojo.destroy(dialog);
}
});
var yesBtn = new dijit.form.Button({
label: "Yes",
style : "width : 60px",
onClick : <your function here>,
dialog.hide();
dojo.destroy(dialog);
}
});
//adding buttons to the div, created inside the dialog
dojo.create(yesBtn.domNode,{}, div);
dojo.create(noBtn.domNode,{}, div);
dialog.show();
</script>
我将此代码用作内联道场/方法 - 在按钮的单击事件上。 你仍然可以修改
从 Dojo 1.10 开始支持确认对话框。
请参阅发行说明和文档。
上面的解决方案没有考虑对话框右上角的小十字。
很久以前,我做过一小套对话,你可能会在这里找到一些快乐,尤其是确认对话.js我今天刚刚将它们上传到github上,所以你可以看看它们:http://github.com/PEM-FR/Dojo-Components/tree/master/dojox/dialog
它们应该"按原样"可用或稍作更改
相关文章:
- 删除确认对话框在第一次单击时不起作用
- javascript确认对话框有时会不断出现
- 如何为javascript方法放入jquery确认对话框
- 是否可以将JXBrowser显示的JS确认对话框的结果返回到调用它的JS部分
- 如何在批准露天共享中工作流的审核步骤之前添加确认对话框
- MVC3 Ajax链接确认对话框使用jquery ui对话框
- 是否可以隐藏javascript确认对话框
- Javascript/C# - 满足语句条件时的确认对话框
- 提交表单前使用确认对话框的正确方法
- 在浏览器关闭时,单击确认对话框中的“停留在页面上”,执行一个方法
- 确认对话框多次触发
- 为什么JS confirm()获胜't当我在确认对话框中点击“取消”时,取消提交操作
- onbeforeunload确认对话框可以用设计良好的自定义对话框进行自定义
- 是否有任何方法可以在单击“加载前确认”对话框的“确定”按钮后执行某些操作
- 如何处理JavaScript's GridView上的确认对话框's PageIndexChanging
- 如何在jquery确认对话框中使用回调
- 如何在 asp.net 中的页面加载事件之前调用 JavaScript 确认对话框
- 在道场中确认对话框
- 按下 X 之前的 JavaScript 确认对话框
- JAWS 屏幕阅读器误读确认对话框消息.IE11.