I don't know what the problem is. I don't see enough code to say for sure. I do see enough code to know that what you have there isn't a traditional javascript array. It has gaps and inconsistencies. Numbers are numbers and in a javascript array are indexes. Generally you go from [0] to [1] to [2] and so on. You obviously do not seem to be doing that. 00 is no different than 0. 01 is no different than 1. This might be part of what is happening. If you need to use the current convention you have (two numbers for each index, many of them out of sequence), I would be tempted to quote everything and hope for the best (this would essentially turn the array into an object, as long as you were consistent in the rest of your code, that could work):
Code:
priceArray["99"] = 1690;
priceArray["90"] = 1845;
priceArray["01"] = 540;
priceArray["02"] = 720;
priceArray["03"] = 840;
priceArray["04"] = 970;
priceArray["05"] = 1130;
priceArray["06"] = 1300;
priceArray["07"] = 1480;
priceArray["08"] = 1680;
priceArray["09"] = 1845;
priceArray["00"] = 2100;
Also I'm not convinced this is javascript. It could be, but I'm thinking it might be straight Java (a server side language). But, even if so, my advice MIGHT still work. Either way (javascript or Java), much depends upon the rest of the code - the parts that you have not posted.
You MIGHT also have luck with:
Code:
priceArray[99] = 1690;
priceArray[90] = 1845;
priceArray[01] = 540;
priceArray[02] = 720;
priceArray[03] = 840;
priceArray[04] = 970;
priceArray[05] = 1130;
priceArray[06] = 1300;
priceArray[07] = 1480;
priceArray[08] = 1680;
priceArray[09] = 1845;
priceArray["00"] = 2100;
Or not.
If you want more help, please provide a link to the page on your site that contains the problematic code.
Also - if you know, is this Java or javascript?
Bookmarks