al-rafideen
Dec 12 2007, 05:49 PM
| | Hi, I have no problem with one dimension Array. For example: Y = new Array(); Y[0] = smith; Y[1] = john; .. ..
My problem is with two dimension Array. For example: Y[0,0] = smith; Y[0,1] = john; .. .. Do you agree to define Y = new Array() with two dimension Array. Thank you for your help in this matter.
|
Reply
Jeigh
Dec 12 2007, 10:16 PM
As far as I know (I may be wrong, I don't do a lot of javascript work) there are not true 2d arrays in javascript. You can, however, declare one array and then declare elements within that array as arrays which in effect is a multi-dimensional array. The site at http://www.javascriptkit.com/javatutors/twoarray1.shtml can show you an example and I found a bunch more just by quickly googling for '2d arrays in javascript'. It will likely take some playing around but if its important to your design I'm sure you can get something working that will be equivalent to having a 2 dimensional array.
Reply
kelvinmaki
Dec 13 2007, 03:06 PM
Actually declare Y = new Array() is for the top level of the array, not a 2D array. So afterwhich you've declared that, you need to declare another array inside of Y. So like, Y = new Array(); Y[0] = new Array(); Y[1] = new Array(); Then you are allow to put data into Y[0] array. eg. Y[0][0] = smith; Y[0][1] = smith2; Y[1][0] = john; Y[1][1] = john2; Now then you'll have a 2D array. I've gotten error not declaring new Array() for both cases. Hope this help. Cheers
Reply
Recent Queries:--
how to connect the database throught the javascript in confirm box - 179.60 hr back. (1)
Similar Topics
Keywords : y, array,
- OSCommerce Errors
Passed variable is not an array or object (5)
Day_sort()
Sort an array by day (1) If it wasn't for vujsa and HandyPHP.com , or the discussion over at Trap17.com . I would
have had no reason to make this function more flexible and act more like a PHP function. So this is
why I have done this, though I would have contributed it to Trap17.com , I was not a member over
there nor does it benefit me in anyway. None of the code has been taken from HandyPHP.com .
It's a complete rewrite in a way I felt works better for most people, it could do with better
error handling though, but that can be discussed here if needs be. So here it is: day....
Raid 1 Array
question... (6) I want to implement a RAID 1 array in my computer with 2 80 GB drives. However, after reading a bit,
(maybe the wrong stuff) I ended up at the point that Windows XP Professional does not support
mirroring. I'm not interested in the other forms of RAID to increase performance. with the power
outages all the time my primary concern is backing up the data. So is it true that mirroring is not
available with XP Pro?....
Passing Select List As An Assoc. Array
(1) I'm trying to pass a select list as an associative array, but evertime I do this the $key
becomes numbered from 0 up like a normal array. I have an onchange on a select list that
generates an addbox. The currentbox is loaded the first time the page is loaded by pulling from the
database. I want to only pull that one time, and each time the select list generates new results
for the add box, I want the data inside of the current box to be sent to itself. Here's a
diagram of the layout: As you can see the arrows indicate that the items are to be move....
Array Of <divs> In Another <div> Tag
(2) I have a tag with id="foo" containing numerous tags in it. Throught the course of my script, I
need to make some of the int foo hidden and some visible. To this end, I was wondering if there
is some way to create or get an array of the various tags in foo. ~Viz....
MySQL: Help Needed With MySQL_fetch_array() Error
help needed (7) I have my site up and running, it it written in php but the problem im getting is the mysql database
the warning is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in /home/mrogers/public_html/config.php on line 47 but on line 47 it shows this:
$email = mysql_fetch_array($adminemail); any one help on this + my site wont connect to
my database. I have feeled out all the requirements that has asked and i know its write. All help
would be apreciated as i would like my site fully functional by next week. /smile.gif' bord....
Help Needed With MySQL_fetch-array() Error
(3) databasing is quiet hard to learn but im starting to get the hang of it. on my home page i have a
few errors like this Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in /home/mrogers/public_html/html/nav.php on line 80 i have checked whats on line 80 and
this is what i ended up with $row = mysql_fetch_array($sql); but it does not look like
anything is wrong and i kind of do not under stand the mysql witch i am learning at the moment, but
any one know what the problem is please tell me. need any more info like the whol....
[visual Basic] How To Confirm A Array Is Null
(6) for example, Dim array() as integer during run time, how to confirm a array is null (do not
contain any element) Thanks....
Array Sorting
Does anyone hava a decent JAVA method (21) does anyone have a decent JAVA method that will sort an array from smallest-to highest?
/mellow.gif" style="vertical-align:middle" emoid=":mellow:" border="0" alt="mellow.gif" /> The one
i'm trying to write doesn't seem to work... or if you could look at mine below, and tell me
what i did wrong, that'd be nice to.(if it reallllyyyyyyyyy sucks, please dont laugh to loud
/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> ) This should
take an array and then calculate how many of a number is in it, add it to the first slots....
Convert a byte array to an int and vice versa
(2) Due to a horrible file i/o system I have to use at work (reads in a file and returns an array of
bytes), I needed to write a conversion scheme for making these bytes into ints and back again.
I'll post it up here for you guys. Note: this only handles the PC's little endian-ness.
uint32 GetInt32( uint8 *pBytes ) { return (uint32)(*(pBytes + 3) } void Int32ToUInt8Arr( int32
val, uint8 *pBytes ) { pBytes = (uint8)val; pBytes = (uint8)(val >> 8); pBytes = (uint8)(val
>> 16); pBytes = (uint8)(val >> 24); }....
Looking for y, array,
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for y, array,
|
advertisement
|
|