Error: dhtmlxTabBar is undefined

I am attempting to use the dhtmlxTabBar but I am unable to initialize the tab bar using javascript. I have followed your example and can initialize the tab bar using html but not when I use javascript. The error I am receiving is: “dhtmlxTabBar is undefined”. Normally, I would conclude that one of the required .js files is not included in the page. However, this is not the case.



In the example below, I have two tab bars. Tabbar B (b_tabbar) is created and Tabbar A (a_tabbar)is not. Both of these tabbars make use of the included .js files, so I’m not sure what the root of the problem would be. It may have something to do with the web server because both of these tab bars initialize when I view the page by opening the html file directly in a browser rather than going through the web server. I’m running Tomcat 6.018.



Can anyone offer a suggestion?































Content 1


Content 2


Content 3














Tab Bar A uses the following xml file…



<?xml version="1.0"?>





Tab1

Tab2

tab3



The correct name of object is dhtmlXTabBar ( the letter X is capital , casing is important )

tabbar=new dhtmlXTabBar(“a_tabbar”,“top”);

XML loading is async., so the correct code is
tabbar.loadXML(“tabs.xml”,function(){
tabbar.setTabActive(“a1”);
});



Thank you for your quick response.



However, I made the changes you suggested and I am getting the same results. The new html file is as follows…



 




















   
Content 1

   
Content 2

   
Content 3










 



 



Any idea why the a_tabbar is not visible?



 



Mike


After modifying the html again, I was able to get the tabbar to initialize by placing the script which loads the tabbar after the div element. I’m not certain why this is working, but the working file I have for the benifit of others is below. Thank you for the support.



 



 




























I’m not certain why this is working, but the working file I have for the benifit of others is below.
The container must exist on moment of script initialization, if you have script before HTML , the code will be executed when tabbar’s container is not rendered yet, so moving code after HTML or runing it from onload event will resolve issue.