当前位置 : 主页 > 网页制作 > Dojo >

用dojo生成全代码form的工具

来源:互联网 收集:自由互联 发布时间:2021-06-15
/* * author:sjbwylbs,email:sjbwylbs@163.com */ dojo.provide("ijqg.utils.FormHelper"); dojo.require("dijit.form.Button"); dojo.require("dijit.form.Button"); dojo.declare("ijqg.utils.FormHelper", [], { className : "FormHelper", constructor:fu
/* * author:sjbwylbs,email:sjbwylbs@163.com */ dojo.provide("ijqg.utils.FormHelper");
dojo.require("dijit.form.Button"); dojo.require("dijit.form.Button");
dojo.declare("ijqg.utils.FormHelper", [], { className : "FormHelper", constructor:function(className) { this.className=className; }, addButton : function(pane, name, action) { var button = new dijit.form.Button({ label : name }); pane.appendChild(button.domNode); button.onClick = action; return button; }, addSpan : function(pane,name,title) { var dom= dojo.create("span", { id : this.className + name, innerHTML : title }); pane.containerNode.appendChild(dom); return dom; }, addInput : function(pane,name) { var dom= dojo.create("input", { id : this.className + name, type : "text" }); pane.containerNode.appendChild(dom); return dom; }, addContentArea : function(name) { return dojo.create("div", { id : this.className + name, className : "dijitDialogPaneContentArea formItem" }); }, addActionBar : function(form, name) { var dom = dojo.create("div", { id : this.className + name, className : "dijitDialogPaneActionBar formItem" }); form.containerNode.appendChild(dom); return dom; }, addLabel : function(name, htmlFor) { return dojo.create("label", { innerHTML : name, htmlFor : htmlFor }); }, addFormArea : function(form, name, title) { var dom = this.addContentArea(name); dom.appendChild(this.addLabel(title, name)); form.containerNode.appendChild(dom); return dom; } });
网友评论