用dojo生成全代码form的工具

前端之家收集整理的这篇文章主要介绍了用dojo生成全代码form的工具前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
/*
* 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,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",
type : "text"
});
pane.containerNode.appendChild(dom);
return dom;
},
addContentArea : function(name) {
return dojo.create("div",
className : "dijitDialogPaneContentArea formItem"
});
},
addActionBar : function(form,name) {
var dom = dojo.create("div",
className : "dijitDialogPaneActionBar formItem"
});
form.containerNode.appendChild(dom);
return dom;
},
addLabel : function(name,htmlFor) {
return dojo.create("label",{
innerHTML : name,
htmlFor : htmlFor
});
},
addFormArea : function(form,title) {
var dom = this.addContentArea(name);
dom.appendChild(this.addLabel(title,name));
form.containerNode.appendChild(dom);
return dom;
}
});
原文链接:https://www.f2er.com/dojo/291629.html

猜你在找的Dojo相关文章