...

View Full Version : Basic: JS Array for a DropDown



Torvik
12-29-2007, 10:41 PM
I'm working with Adobe LiveCycle, and I'm not certain how different that is from working with web stuff. Any thoughts are appreciated.

Any ideas why this doens't work?


var RoomNum=new Array(5)
RoomNum[0]="1";
RoomNum[1]="2";
RoomNum[2]="3";
RoomNum[3]="4";
RoomNum[4]="5";
RoomNum[5]="6";


if (DropDownList1.rawValue == 0) {
DropDownList4.addItem (RoomNum);
}

Instead of giving me the 6 numbers, I just get the word "empty"
Thanks so much!
Alan

brandonH
12-31-2007, 10:11 AM
you do not need to set the array's length, and since you are filling the array with numbers it is easier to do it with a for statement


<script type=text/javascript>
var RoomNum=new Array();
for(i=0;i<6;i++){
RoomNum[i]=i-(-1);
}
alert(RoomNum);

</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum