Forum Moderators: open

Message Too Old, No Replies

Array value

         

hoju312

5:51 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



I have an array that I want to add a value to pass for each option, how do I do it (see below)

<script type="text/javascript" language="javascript">
var dropdownArray = new Array();
dropdownArray["1"] = [
[defaultNote,
[""]
],
["Option1",
[defaultNote,"Suboption1","Suboption2","Suboption3"]
]
];
dropdownArray["2"] = [
[defaultNote,
[""]
],
["Option2",
[defaultNote,"Suboption1","Suboption2","Suboption3"]
]
];

Bernard Marx

6:51 pm on Jun 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



add a value to pass for each option

Could you clarify that a little?

texmex

7:10 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



Can't quite get what you're driving at. Does this help?


var dropdownArray = new Array();
dropdownArray[0]="firstOption";
dropdownArray[1]=Array("2.1","2.2","2.3");
dropdownArray[2]=Array("3.1","3.2","3.3");

//Note this next line actually replaces the second item above
//with a new array
dropdownArray[2][1]=Array("3.2","3.2.2","3.2.3");

//this bit shows the result of those lines above
alert(dropdownArray[0]); //"firstoption"
alert(dropdownArray[1][0]); // "2.1"
alert(dropdownArray[1][1]); //"2.2"
alert(dropdownArray[1][2]); //"2.3"
alert(dropdownArray[2][0]); //3.1
alert(dropdownArray[2][1][0]); //3.2
alert(dropdownArray[2][1][1]); //3.2.2
alert(dropdownArray[2][1][2]); //3.2.3