[thelist] Multidimensional Arrays in JavaScript

Ken Kogler ken.kogler at curf.edu
Tue Sep 24 22:23:02 CDT 2002


Bear with me -- this is gonna be a long one. Code is posted externally
to please the digest folks. :)

Let me start by showing you the recordset I'm trying to work with:

http://www.kenkogler.com/evolt/mdArrJS/1.txt

Fairly straightforward -- there's a few different sizes, and a few
different materials, and the combination of the two determines the
price.

Here's what I'm looking to do:

I need to load all this info client-side. The page will have a series of
radio buttons that allow the user to choose one size, and a <select>
dropdown that allows them to pick one material. I need to then show the
price based on the two options.

Creating the HTML page is not the problem, nor is checking the radio
buttons and dropdown to find out what's selected. The problem comes in
taking those two values (the currently selected size and material) and
checking it against the recordset to return the price, all on the client
side.

Here's as far as I got:

http://www.kenkogler.com/evolt/mdArrJS/2.txt

As you can see, I'm going through the recordset row by row and trying to
create a multidimensional array. Later on in the code (fired by an
onClick), I have this:

  alert(aPrice[10][2]);

Which should return the price of a certain sign, but doesn't seem to
work. I get an "aPrice is undefined" error.

I'm at the end of my knowledge of JS/Arrays -- where's the smart people
at? :)

--Ken




More information about the thelist mailing list