[thelist] inserting value into JS array
Lachlan Cannon
tiedefenderdelta6 at yahoo.com
Fri Feb 1 21:53:00 CST 2002
--- aardvark <roselli at earthlink.net> wrote:
> the array starts off as:
> HM_Array2 = [
> [100, // menu width
> 130, // left_position
> 15, // top_position
> "#000000", // font_color
>
> but i want to replace that 15 with a different number
> depending on
> platform, thereby adjusting its offset from the top of
> the window...
Well, since you know what the index of the array is, you
can use that. Since javascript is 0-based, it's index is
[2], so you could use that.
HM_Array2 = [100, 130, 15, "#000000",...];
if (isMac()) {HM_Array2[2] = 0;
or before you do the array
var topoffset = (isMac()) ? 0: 15; //Dunno if I got the
syntax right- never used ternary before
HM-Array2 = [100, 130, topoffset, "#000000",...];
HTH
Lach
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
More information about the thelist
mailing list