...

View Full Version : How to bind 2 or more arrays together?



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:

joh6nn
08-20-2002, 03:08 AM
MenuName[3]=["M4NoHref","","","Link"];

this is a string, not an array name. using it to refer to an array won't work, because it doesn't have any connection to the array. if you want to make it work, try this:

MenuName[3]=["M4NoHref","","",];
MenuName[3][3] = ["Google","http://www.google.com"];



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum