html - How do i create a div with dojo create? -


i want generate divnodes0 div example via dojo create (including h1 , ul):

<body class="mobile">     <div dojotype="dojox.mobile.view" id="mobileview">         <div dojotype="dojox.mobile.scrollableview" id="divnodes01" scrolldir="v" style="background-color: #d0d0d0;">             <h1 dojotype="dojox.mobile.heading" fixed="top" id="h1nodes01"></h1>             <ul id="ulnodes01" dojotype="dojox.mobile.roundrectlist"></ul>         </div>     </div> [...] </body> 

i tried way (without sucess):

var mobileview = document.getelementbyid("mobileview"); dojo.create("div",{             id: "divnodes0",             dojotype: "dojox.mobile.scrollableview",             scrolldir: "v",             style: "background-color: #d0d0d0"             },             mobileview,"first");   var mainnodediv = document.getelementbyid("divnodes0"); dojo.create("h1",{             id: "h1nodes0",             dojotype: "dojox.mobile.heading",             back: "zurŸck",             moveto: "divnodes0",             fixed: "top",             label: "knoten&uuml;bersicht"             },             mainnodediv,"first");      dojo.create("ul",{             id: "ulnodes0",             dojotype: "dojox.mobile.roundrectlist"             },             mainnodediv); 

greets tom

if want nodes id, want use dojo.byid('someid')

the third parameter dojo.create can either domnode (like using) or id of dom node: dojo.create('h1',{},'divnodes0','first')

based on usage of dojotype attribute seems want use "widgets" rather dom nodes. widgets template of domnodes built in styling , event handling reusable. instantiating , placing widgets simple:

var heading = new dojox.mobile.heading({   id: "h1nodes0",   dojotype: "dojox.mobile.heading",   back: "zurŸck",   moveto: "divnodes0",   fixed: "top",   label: "knoten&uuml;bersicht" }); heading.placeat('divnodes0','first'); 

Comments