prasadalone
Programmer
- Aug 15, 2002
- 87
i am creating treemenu with exsisting code
Following is my code for creating array which is currently upto level 2 i want to add level three
how to add it
eg right now only following two levels working i want to add level three
1 working
1 working
-- working
-- working
2 -- working
2.1 working
2.1.1 not working
------
function populateq() {
var a = new Array(), s = new Array();
var j = 0, k = 0, id, area, subject, level;
for (var i=0; i<q.length; i++) {
id = q[0];
area = id.substring(0,2);
subject = id.substring(0,4);
aname = q[1];
level = id.length / 2;
if (level == 1) {
treeMenu.addItem(new TreeMenuItem(aname,"index1.asp?method=content&id="+id,"mainframe"));
a[id] = new TreeMenu();
if (treeMenu.items[j]) {
treeMenu.items[j].makeSubmenu(a[id]);
rlookup[id] = j;
j++;
k = 0;
}
}
else if (level == 2) {
if (a[area]) {
a[area].addItem(new TreeMenuItem(aname,"index1.asp?method=content&id="+id,"mainframe"));
s[id] = new TreeMenu();
a[area].items[k].makeSubmenu(s[id]);
k++;
}
}
else
if (s[subject])
s[subject].addItem(new TreeMenuItem(aname,"index1.asp?method=content&id="+id,"mainframe"));
}
q = a = s = null;
}
Following is my code for creating array which is currently upto level 2 i want to add level three
how to add it
eg right now only following two levels working i want to add level three
1 working
1 working
-- working
-- working
2 -- working
2.1 working
2.1.1 not working
------
function populateq() {
var a = new Array(), s = new Array();
var j = 0, k = 0, id, area, subject, level;
for (var i=0; i<q.length; i++) {
id = q[0];
area = id.substring(0,2);
subject = id.substring(0,4);
aname = q[1];
level = id.length / 2;
if (level == 1) {
treeMenu.addItem(new TreeMenuItem(aname,"index1.asp?method=content&id="+id,"mainframe"));
a[id] = new TreeMenu();
if (treeMenu.items[j]) {
treeMenu.items[j].makeSubmenu(a[id]);
rlookup[id] = j;
j++;
k = 0;
}
}
else if (level == 2) {
if (a[area]) {
a[area].addItem(new TreeMenuItem(aname,"index1.asp?method=content&id="+id,"mainframe"));
s[id] = new TreeMenu();
a[area].items[k].makeSubmenu(s[id]);
k++;
}
}
else
if (s[subject])
s[subject].addItem(new TreeMenuItem(aname,"index1.asp?method=content&id="+id,"mainframe"));
}
q = a = s = null;
}