Page 1 of 1

Using loops within loop statements

Posted: Sat Sep 20, 2003 6:44 am
by lunartek
I'm trying to use multiple loops within other loops using arrays, for some reason it refuses to call the second array.

The arrays:

Code: Select all

soptions = new Array(
"Acceleration|sacceleration", "Angle|sangle"
);

sacceleration = new Array(
"Acceleration of Free Fall|9.80665", "Galileo|0.01"
);
Now the looping:

Code: Select all

function select(selopt,selname){
document.write("<SELECT NAME="+selopt+"><option selected>"+selname+"</option>");

for(value in soptions)&#123;
document.write("<option>-- "+soptions&#1111;value].split("|")&#1111;0]+"</option>");

for(value2 in soptions&#1111;value].split("|")&#1111;1])&#123;
document.write("<option>&nbsp;&nbsp;"+soptions&#1111;value].split("|")&#1111;1]&#1111;value2].split("|")&#1111;0]+"</option>");
&#125;
&#125;

document.write("</SELECT>");
&#125;

Any ideas would be great :) but I don't see why the above code wouldn't work, it should be possible.

--lunartek