Msg#: 4055540 posted 10:46 pm on Jan 6, 2010 (gmt 0)
I need to be able to use the value of a passed function parameter to find the length of an array with the same name. Everything I've tried just gives me the length of the string value being passed. My goal is to be able to change the parameter and automatically change which array the HTML is accessing. Please help me! Here's a bit of my code:
Msg#: 4055540 posted 1:28 am on Jan 7, 2010 (gmt 0)
Yes, that gets you an array of the two items.
However you have a problem in the line var randomGallery = Math.floor(Math.random()*10); I think you want to change that * 10 with the catlength, otherwise 1) It will sometimes exceed the size of the array (if it is smaller than 10). 2) Will never get items in the array that are beyond the 10th item.
Then you can get rid of that while loop as well, as I think all you are doing there is discarding ones that are out of range.
Msg#: 4055540 posted 11:03 pm on Jan 7, 2010 (gmt 0)