Categories | Question details Back To List | ||
How to set Default Tab when use xml from this xml : <?xml version="1.0"?> <tabbar> <row> <tab id="b1" width='100px'>Tab 2-1</tab> <tab id="b2" width='100px'>Tab 2-2</tab> <tab id="b3" width='100px'>Tab 2-3</tab> <tab id="b4" width='100px'>Tab 2-4</tab> </row> </tabbar> and id html i write : <script> tabbar=new dhtmlXTabBar("targerTab","top"); tabbar.setImagePath("Runtime/images/"); tabbar.loadXML("Runtime/XML/tabs.xml"); if(tabbar.getActiveTab()==null){ //alert(); //--> work if take out comment this alert tabbar.setTabActive("b3"); } </script> it work when i take out comment at alert() why? Answer posted by Support on May 13, 2008 09:41 The XML loading is async, so in moment when command next to loadXML executed data not loaded yet, it just in loading process. To be sure that data loaded you can use second parameter of loadXML command tabbar.loadXML("Runtime/XML/tabs.xml",function(){ // code here will be called only after data loading if(tabbar.getActiveTab()==null){ tabbar.setTabActive("b3"); } }); |