FYI, the quotedValueList thing helped a LOT. :)

Ok, if any of you really care to know... I'm a fairly avid gamer, in the 
MMORPG genre. There's a new game coming up in the next few months. I 
contribute to a site for another, already existing game, that has a 
character builder app on it. (daoc.catacombs.com - check it out, it's very 
slick. IE only though). I'm working on a similar type app for this upcoming 
game, which can be found at daoc.catacombs.com/sb/ if you care to check it.

These apps are very heavy JS apps - i.e., they load up ALL the relevant 
data into JS variables from the get-go, and then as you change your 
choices, JS functions loop over various arrays, check for data, and 
repopulate other form elements. I've got that part down fine, no worries.

What I'm trying to do is improve the efficiency of the initial data 
building. I've done that just now to a great extent - what used to be me 
using cfloop over a query and building up two-dim arrays line by line, end 
result being

arrayName[1][1] = 1;
arrayName[1][2] = 1;
arrayName[2][1] = 1;

etc, I've reworked to ditch the two-dimensionality of these arrays. I now 
build up a list of what would be the 2nd dimension, with a dummy record at 
the start (as JS arrays start with position 0 instead of 1) and a comma at 
the end, i.e.

arrayName[1] = '0,1,2,';
arrayName[2] = '0,1,';

Before, when looping over the array, I'd check against dim1 and dim2 and 
see if it was true (i.e. setting it to 1 in the first example). Now, I 
check to see if arrayName[dim1].indexOf(',' + dim2 + ',') > 0. i.e., I look 
to see if ',1,' is in arrayName[1] or not.

In doing this I trimmed down my end source from around 2100 lines to under 
900 in about half an hour. :)

So if anyone's doing stuff like that, using multi-dim JS arrays, you might 
consider this method instead. So far it's working like a champ.

At 05:36 PM 4/30/2002 -0700, you wrote:
>what is the original problem you are trying to solve?  Are you trying to
>make one select box populate when another is picked?
>
>If so then there may be a more efficient way to solve your problem...
>
>Either way, tell the talk list what you are wanting to use JS for and
>perhaps a different perspective will pop up.

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to