469,348 Members | 1,454 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,348 developers. It's quick & easy.

Array returning [object Object]

So, with the luck on the first dilemna I thought I'd ask here again.
I have an array that's returning [object Object] instead of what it's assigned.
I am creating an array to hold a listbox list.
Expand|Select|Wrap|Line Numbers
  1. function list(name, value) {
  2.     this.name = name;
  3.     this.value = value;
  4. }
  5.  
  6. function populateList(b){
  7.  
  8. var airforce = new Array();
  9.  
  10. airforce[0] = new list("General", "General");
  11. airforce[1] = new list("Lieutenant-General", "Lieutenant-General");
  12.  
  13. switch = b;
  14.  
  15. switch (branch){
  16.             case "airforce":
  17.                 for (var i=0;i<airforce.length;i++) {
  18.                 document.form1.Rank.options[i] = new Option(airforce[i]);
  19.                 }
  20.             break
  21.             ...
  22.                         ...
  23.             default:
  24.             }
  25.  
Now, all was working great when I just wanted to populate with just airforce[0] = "General"; and so on, but when I wanted to use the function to create the array all went wonky.
Mar 1 '07 #1
1 1324
Crap! Never mind. I was missing the second array item in my Option insert. Derr
Mar 1 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.