开发者

dojo equivalent of document.X

开发者 https://www.devze.com 2023-02-19 06:33 出处:网络
What will be the dojo equivalent code of following.? var msgContainer = docum开发者_C百科ent.createElement(\'div\');

What will be the dojo equivalent code of following.?

var msgContainer = docum开发者_C百科ent.createElement('div');
msgContainer.id = 'alert';             // set id of div
msgContainer.setAttribute('role', 'alert');
msgContainer.className = 'contenthide' // set class name
msgContainer.appendChild(document.createTextNode(msg));
document.body.appendChild(msgContainer);


var div = dojo.byId('alert');
while (div) {
 div.parentNode.removeChild(div);
 div = dojo.byId('alert');
}


var msgContainer = dojo.create("div", { 
                           id:"alert",
                           role:"alert",
                           "class":"contenthide",
                           innerText:msg }, dojo.body());

Please check on the Dojo Toolkit's documentation for more DOM functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消