Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tapani Jalonen on Nov 05, 2008 06:13
open dhtmlx forum
Tabs do not initialize

Hello,

Even though I have included the necessary files for TabBar, I keep getting a "not defined" -message.

I went through the basic examples and it seems pretty straightforward. Just include the general JS, as well as the two tab JS files. Then, create a div and initialize a new dhtmlXTabBar for that div.

Here are the includes and the rest of the source:

<script language="text/javascript" src=".../dhtmlxcommon.js"></script>
<script language="text/javascript" src=".../dhtmlxtabbar.js"></script>
<script language="text/javascript" src=".../dhtmlxtabbar_start.js"></script>

<div id="a_tabbar" style="width:400;height:100; clear: both;"></div>

var tabbar=new dhtmlXTabBar("a_tabbar","top");
tabbar.setImagePath("..../imgs/");
tabbar.loadXML("tabs7.xml");

Even this simple thing doesn't work because dhtmlXTabBar is not defined. What am could I possibly be doing wrong?
Answer posted by Support on Nov 05, 2008 09:45
You are using in your paths "..." - 3 dots, is it have any special meaning?
The reason of error - dhtmlxtabbar.js can't be located, most probably because used path is incorrect. 
Answer posted by Tapani Jalonen on Nov 05, 2008 13:05
You are using in your paths "..." - 3 dots, is it have any special meaning?
No, the 3 dots just represent the path to the file. The path is actually much longer ;)

The reason of error - dhtmlxtabbar.js can't be located, most probably because used path is incorrect.
I thought the problem was locating the JS files, but I also tried putting them into the same folder. I am familiar with including JS files, their paths and so on, that can not be the problem. However, from previous experience that's what I thought of as well, since the object that should be initialized just doesn't exist. It's the oddest thing, this should work without problems especially if the JS is in the same folder as the  .jsp file that contains the initializing script.

I'm using a mac with firefox 2. The script is in a Apache/Tomcat environment.
Answer posted by Support on Nov 06, 2008 01:26
Try the next thing - load the page with tabbar in FF, and after page loading remove "index.html" part of url and put the path, used for js file there - if path correct, then content of js file must be shown. 

>>I'm using a mac with firefox 2. The script is in a Apache/Tomcat environment.
The TomCat process files case sentensive, so if you are using full path - be sure that case of path and file name exactly the same as on file system. 
Answer posted by Tapani Jalonen on Nov 06, 2008 03:46
Yes, the JS file contents are shown in Firebug "script" view. I know this because if the path is incorrect, the script view doesn't show the source, but instead a Tomcat "file not found" -error message. The script seems to get loaded nicely. I did forget to add the CSS file, which I now added.

I actually got the tabs working now, strangely enough. I mean, I didn't make any significant changes. It could be some caching problem with a combination of Mac/Firefox/Javascript? I'm working with Eclipse, which has occasional weird publishing behavior as well.






Answer posted by Support on Nov 06, 2008 04:24
>> It could be some caching problem with a combination of Mac/Firefox/Javascript?
May be so. If you have loaded the page with incorrect script path first time, FF may cache incorrect response, and reuse it instead of loading correct files next time.
Answer posted by Xabi on Jun 17, 2009 05:12
if you are using a jsp try deleting

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

Once I delete from the JSP it runs OK.