Dojo确认对话框'缺少:在属性id'之后;和'找不到节点'
Dojo Confirm dialog 'missing: after property id' and 'node was not found'
我在这里发现了一个带有yes-no按钮的dojo confim对话框。我稍微修改了一下,但它不起作用。(我需要补充的是,即使没有修改,它也不起作用)
Firebug揭示了两种问题:
1, SyntaxError: missing : after property id
dialog.hide();
和
2, dojo/parser::parse() error
[Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NotFoundError)" location: "https://gaia.acrys.com:8843/arranger/dojo/dojo.js Line: 226"] { constructor=DOMException, code=
不用说,我离成为道场大师还有几光年,尽管如此,下面的代码对我来说似乎合乎逻辑,所以我不知道如何修复它。
这是我的代码:`
<script type="text/javascript">
dojo.require("dijit.form.Button");
dojo.require("dijit.Dialog");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
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 : alert("I clicked yes"),
dialog.hide();
dojo.destroy(dialog);
}
});
//adding buttons to the div, created inside the dialog
dojo.create(yesBtn.domNode,{}, div);
dojo.create(noBtn.domNode,{}, div);
</script>`
我这样称呼它:
<button data-dojo-type="dijit/form/Button" type="submit" name="deleteIdx" value="19524803" onclick="dialog.show();">
如有任何建议,不胜感激。
您的问题出现在以下代码中:
var yesBtn = new dijit.form.Button({
label: "Yes",
style : "width : 60px",
onClick : alert("I clicked yes"),
dialog.hide();
dojo.destroy(dialog);
}
});
onClick
函数错误,应为
var yesBtn = new dijit.form.Button({
label: "Yes",
style : "width : 60px",
onClick : function() {
alert("I clicked yes"),
dialog.hide();
dojo.destroy(dialog);
}
});
相关文章:
- Javascript复选框函数:;缺少:在属性id之后"
- 语法错误:缺少:在属性 ID 之后
- JSON到带有Django的JS:SyntaxError:缺少:在属性id之后
- Ajax - 在“成功”之后转到另一个页面,从那里的URL中检索用户ID
- 在为 jquery 自动完成设置源代码时获取“语法错误:缺少:在属性 ID 之后”
- ngResource 在 $save() 之后从 POST 响应中检索唯一 ID
- j查询错误 - 语法错误:缺少:在属性 ID 之后
- 缺少解析错误:在属性 ID 之后
- Dojo确认对话框'缺少:在属性id'之后;和'找不到节点'
- jQuery)SyntaxError:缺少:在属性id之后)
- 为什么我在循环之后只得到最后一个id道具
- 缺少:在属性id-javascript之后
- 语法错误:缺少:在属性 ID 之后
- 只需要获取ID的一部分最后一个下划线之后的所有内容
- 错误:缺少:属性id之后
- 如何检查一个元素在id的哈希符号之后是否有一个字符串?
- 在一个ng-repeat之后,我需要隔离并抓取一个元素'id'
- 如何重载/刷新'id'在特定时间之后使用Ajax
- 尝试将焦点设置在表单元素的id上,使用在警报消息之后,但是JSP页面提交
- Javascript在具有特定id的行之后将行插入表中