Ovidiu
08-19-2002, 11:24 PM
How to bind 2 or more arrays together?
I set up the arrays like this:
var MenuName=new Array();
MenuName[0]=["Menu1","first.htm"];
MenuName[1]=["Menu2","prof.htm"];
MenuName[2]=["Menu3","myself.html"];
MenuName[3]=["M4NoHref","","","Link"];
MenuName[4]=["M5NoHref","","","Civil"];
var Link=new Array();
var Exe=new Array();
Link[0]=["Google","http://www.google.com"];
Link[1]=["Yahoo","http://www.yahoo.com"];
Civil[0]=["C1","http://www.discovery.com"];
Civil[1]=["C2","http://www.nationalgeographic.com"];
Then I wanted to link the first one (MenuName) with the second(Link):
for (i=0;i<MenuName.length;i++){
if (MenuName[i][3]) { txt=MenuName[i][3] }
//this is wrong I guess
for (j=0;j<txt.length;j++){
document.write('<div><table><tr><td>'
+txt[j][0]+'</td></tr></table></div>')}
//where txt[j][0] , for i=0 && j=0, should be "Google"
Can someone help me with this???
:confused:
I set up the arrays like this:
var MenuName=new Array();
MenuName[0]=["Menu1","first.htm"];
MenuName[1]=["Menu2","prof.htm"];
MenuName[2]=["Menu3","myself.html"];
MenuName[3]=["M4NoHref","","","Link"];
MenuName[4]=["M5NoHref","","","Civil"];
var Link=new Array();
var Exe=new Array();
Link[0]=["Google","http://www.google.com"];
Link[1]=["Yahoo","http://www.yahoo.com"];
Civil[0]=["C1","http://www.discovery.com"];
Civil[1]=["C2","http://www.nationalgeographic.com"];
Then I wanted to link the first one (MenuName) with the second(Link):
for (i=0;i<MenuName.length;i++){
if (MenuName[i][3]) { txt=MenuName[i][3] }
//this is wrong I guess
for (j=0;j<txt.length;j++){
document.write('<div><table><tr><td>'
+txt[j][0]+'</td></tr></table></div>')}
//where txt[j][0] , for i=0 && j=0, should be "Google"
Can someone help me with this???
:confused: