下面为使用dojo动态创建Button的代码段。
function createButton(id, params){
var button = document.createElement("span");
button.setAttribute("id", id);
dojo.byId("somewherePlaceButton").appendChild(button);
new dijit.form.Button(
params
,dojo.byId(id));
}
调用例子:
createScenicSpotButton('button1',{id: "html_Button1",label: "",alt: "My button",title: "Button1",onClick: HandleFunction});