Html 如何在dojo对话框中定位按钮?
我使用javascript和dojo。基于“关于非参考底图”对话框,我创建了一个对话框。现在我想将我的按钮添加到对话框中。按钮是dojo按钮,并且所有按钮都在。如何在对话框中找到这些Html 如何在dojo对话框中定位按钮?,html,button,dojo,Html,Button,Dojo,我使用javascript和dojo。基于“关于非参考底图”对话框,我创建了一个对话框。现在我想将我的按钮添加到对话框中。按钮是dojo按钮,并且所有按钮都在。如何在对话框中找到这些 require(["dijit/Dialog", "dijit/DialogUnderlay", "dojo/domReady!"], function(Dialog, DialogUnderlay){ //just for the snippets to get the right styling
require(["dijit/Dialog", "dijit/DialogUnderlay", "dojo/domReady!"], function(Dialog, DialogUnderlay){
//just for the snippets to get the right styling
document.body.className = "tundra";
myDialog2 = new Dialog({
title: "My Dialog",
content: "Test content.",
style: "width: 300px"
});
showDialog2 = function () {
myDialog2.show().then(function() {
DialogUnderlay.hide()
//little hack to avoid JS error when closing the dialog
DialogUnderlay._singleton.bgIframe = {destroy: function() {}}
});
}
});
无参考底图显示
放大
缩小
完整范围
前范围
下一个范围
平底锅
使停止工作
最简单的方法似乎是这样编写html代码:
var setContent = "<div data-dojo-type="dijit/form/Button" id="zoomin" >Zoom In</div>";
setContent += "<div data-dojo-type="dijit/form/Button" id="zoomout" >Zoom Out</div>";
setContent += "<div data-dojo-type="dijit/form/Button" id="zoomfullext" >Full Extent</div>";
myDialog2 = new Dialog({
title: "My Dialog",
content: setContent ,
style: "width: 300px"
});
如果为
对话框
的内容
属性指定domNode
,dojo将放置该节点并为您启动小部件
require([“dijit/Dialog”,“dijit/DialogUnderlay”,“dojo/dom”,“dojo/domReady!”),函数(Dialog,DialogUnderlay,dom){
//只是为了让代码片段获得正确的样式
document.body.className=“苔原”;
myDialog2=新建对话框({
标题:“我的对话”,
内容:dom.byId('navtool'),
样式:“宽度:300px”
});
showDialog2=函数(){
myDialog2.show().then(函数()){
DialogUnderlay.hide()
//关闭对话框时避免JS错误的小技巧
DialogUnderlay.\u singleton.bgIframe={destroy:function(){}
});
}
});代码>
放大
缩小
完整范围
前范围
下一个范围
平底锅
使停止工作
无底图显示
谢谢@ben和Mibrock。
myDialog2 = new Dialog({
title: "My Dialog",
content: setContent ,
style: "width: 300px"
});