Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8165859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:39:58+00:00 2026-06-06T19:39:58+00:00

This is a very strange to me actually. I can’t figure out how create

  • 0

This is a very strange to me actually. I can’t figure out how create a multidimensional array dynamically. I want to create a three-level drop-down list, so I think I need a three dimensional array to store the values. How to create three dimensional array?

<script language=javascript>

var aCourse=new Array();
aCourse[0]=new Array();
aCourse[1]=new Array();
aCourse[2]=new Array();
aCourse[3]=new Array();

aCourse[0][0]="Select...";
aCourse[1][0]="Select...";
aCourse[1][1]="T Square";
aCourse[1][2]="V Square";
aCourse[1][3]="S Square";
aCourse[1][4]="B Square";
aCourse[1][5]="G Square";
aCourse[2][0]="Select...";
aCourse[2][1]="N Square";
aCourse[2][2]="W Square";
aCourse[3][0]="Select…";
aCourse[3][1]="J Square";
aCourse[3][2]="M Square";

function ChangeCourse()
{
var i,
iCategoryIndex;
iCategoryIndex=document.frm.optCategory.selectedIndex;
iCourseCount=0;
while (aCourse[iCategoryIndex][iCourseCount]!=null)
iCourseCount++;
document.frm.optCourse.length=iCourseCount;
for (i=0;i<=iCourseCount-1;i++)
document.frm.optCourse[i]=new Option(aCourse[iCategoryIndex][i]);
document.frm.optCourse.focus();
}

</script>
<body ONfocus=ChangeCourse()>
<h3>Choose category…</h3>
<form name="frm">
<p>Category:
<select name="optCategory" size="1" onChange=ChangeCourse()>
<option>Select…</option>
<option>Soccer</option>
<option>Cricket</option>
<option>Rugby</option>
</select>
</p>
<p>Fields
<select name="optCourse" size="1">
<option>Select…</option>
</select>
</p>
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:40:01+00:00Added an answer on June 6, 2026 at 7:40 pm

    If your only problem is creating the three-dimensional array, this should work:

    var aCourse = [];
    
    for(var i = 0; i < dimensionOneSize; i++) {
      aCourse[i] = [];
      for(var k = 0; k < dimensionTwoSize; k++)
        aCourse[i][k] = [];
    }
    

    It is good to note that JavaScript supports the short-hand definition of an array with square brackets [], so you can use those to make the dynamic definition cleaner.

    Possibly Shorter

    Also, I’m not sure if this works very well, but it might:

    var aCourse = [[[]]];
    

    So far, my testing has not proven a way to use this, but it does validate as a proper script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is very strange because as far as I can tell the method does
This problem is very strange and I'm hoping someone can help me. For the
This is a very strange problem, and I just hope that I can clearly
I'm having a very strange issue, it looks like my application can't create file
ok..this is very strange....i have defined a button, actually 5 buttons and each have
This very strange. When I resize a WinForms dialog the controls are flickering very
This is very strange, but when I add the mysql_real_escape_string it doesn't load the
It was very strange when I saw this on debugging my application. int iTag
it is very strange, because this error doesn't happen all the time... I have
I am getting a very strange error in my code. This assignment is for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.