You are not logged in.
If I include the xinhacore.js script, I get an error message moaning about one of the variables in my project in the javascript debug window, which stops execution.
The error is:
tmpIconArray[i].start has no properties.
(tmpIconArray has nothing to do with xinha, its a var in my app that holds arrays of icons for a map)
So I went into my code, commented out all exmaples of tmpIconArray, and all runs fine, with the xinha window displayed. However, functions of my program don't work becuse I had to comment out some lines.
If I now put one line back into my code featuring the var tmpIconArray:
alert(tmpIconArray[i]['start']['image']);
Once I do this, the ALERT executes OK, it shows me the (valid) contents of tmpIconArray, but I still get the 'has no properties' error in the debug window and execution stops.
How can the error be true when the only line containing tmpIconArray correctly outputs it's contents?
Why should xinha affect a variable that has nothing to do with it??
The only thing I can think of is it is something to do with the way the array is assembled.
It comes from PHP, with PHP building the array by constructing echo statesments to echo out the JS.
However, all worked fine before I tried to integrate xinha.
I tried various versions of xinha - all have the same issue
Posting example code will be difficult, it's my app that it is conflicting with, and that requires PHP, MYSQL, phpBB and Google Maps. If I get no answers, I suppose I will try and craft a basic php and JS page that has the same problem.
Please anyone, any ideas?
Last edited by evilc (2007-01-18 12:00:00)
Offline
Also worth noting is that there is another var in my app called iconArray which is built in almost exactly the same way, etc as tmpIconArray, but does not suffer from this issue. I am so stumped
Offline
I have replicated this issue (Not calling it a bug - yet!, I spose it could be my fault) and put up a page to demonstrate it:
http://www.evilc.com/xb/xb.php
Full source code @ http://www.evilc.com/xb/
Offline
Hi, had a look at your code now and found the error
Change
tmpIconArray = new Array();
and the other instances of new Array() to
tmpIconArray = new Object(); // you don't want to use an "Array" here
or easier
tmpIconArray = {}; //this is the same as new Object()
var array = ['value1','value2'];
var associativeArray = {'key1':'value1','key2':'value2'};
(Just to show the difference)
Why it behaved differently with and without Xinha, I don't know
Offline
Thanks for that.
Xinha wasn't loading cause I forgot to upload it;)
Do all the new array()s in the nested loop need to be new Objects()s or just the one declaring the initial var?
Muchos thanks for helping out here, even though it due to my poor coding not yours
For some reason I am having problems with it running locally on this PC, I will try it on my one at work tomorrow.
Offline
Yay! it all works on this other PC, thanks ever so much!
Offline