[thelist] inserting value into JS array

.jeff jeff at members.evolt.org
Fri Feb 1 15:47:01 CST 2002


aardvark,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: aardvark
>
> 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...
>
> and taking the scipt you provided, i made it a function,
> and then call that in an if statement above all this
> array stuff:
> if (IsMac() == true) {
> 	topOffset = "0px"
> }
> else	{
> 	topOffset = "15px"
> }
>
> so, i'm stuck...
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

no you're not, you've got an if/else statement there.  simply convert it to
a ternary statement embedded within your HM_Array2 variable declaration:

HM_Array2 = [
[100,				// menu width
130,				// left_position
(IsMac()) ? 0 : 15,	// top_position
"#000000",      		// font_color

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/





More information about the thelist mailing list