0

我在这里找到了一个带有是-否按钮的 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();">

任何建议都将受到高度赞赏。

4

1 回答 1

0

您的问题出在以下代码中:

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);
                 }
             });
于 2013-08-21T09:28:00.387 回答