Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Basic: JS Array for a DropDown

    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?
    Code:
    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

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Location
    on a ship
    Posts
    574
    Thanks
    1
    Thanked 6 Times in 5 Posts
    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>
    Last edited by brandonH; 12-31-2007 at 10:11 AM. Reason: correction
    I make no attempt at pretending like I'm a professional. I offer help with what knowledge I do have.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •