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
    Jan 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Javascript 2-Dimensional Arrays

    I was wondering how to set an object in a 2d array to a variable.

    This is my menu array, and I want to set the 7th item on the 2nd item (DATEHERE). Idealy I want it to be referenced to a variable so I can set the date to the variable, and the varible to menu[7][2] or something like that.

    menu = new Menu();
    menu.addItem("homeid", "Home", null, "http://marshall.sandi.net", null);
    menu.addItem("About", "About", null, null, null);
    menu.addItem("students", "Students", null, null, null);
    menu.addItem("parents", "Parents", null, null, null);
    menu.addItem("staff", "Staff", null, null, null);
    menu.addItem("teacher", "Teacher Pages", null, null, null);
    menu.addItem("date", "DATEHERE", null, null, null);


    Thank you for any help you can provide!

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Javascript is zero based and thus starts counting beginning at zero not one...
    Try: menu[6][1] = new Date();


  •  

    Posting Permissions

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