javascript|javascript 另类树

function show(sid, fid) {
if (fid.length > 0) {
for ( var f = 0; f < fid.length; f++) {
for ( var j = 1; j < x + 1; j++) {
for ( var i in node.get(j)) {
if (fid[f] == node.get(j)[i]) {
str = fid[f];
index = j;
break;
}
}
}
}
if (str == "") {
x++;
node.put(x, fid);
}
for ( var j = 1; j < x + 1; j++) {
for ( var i in node.get(j)) {
if (sid == node.get(j)[i]) {
index = j;
break;
}
}
}
if (index > 0) {
for ( var i in node.get(index)) {
if (node.get(index)[i] != sid) {
eval("tr" + node.get(index)[i] + ".style.display=\"none\"; ");
$("#tr" + node.get(index)[i]).empty();
var imgmenu = eval("img" + node.get(index)[i]);
imgmenu.src = "https://www.it610.com/article/images/ja.jpg";
}
}

}
} else {
for ( var j = 1; j < x + 1; j++) {
for ( var i in node.get(j)) {
if (sid == node.get(j)[i]) {
index = j;
break;
}
}
}
if (index > 0) {
for ( var i in node.get(index)) {
if (node.get(index)[i] != sid) {
eval("tr" + node.get(index)[i] + ".style.display=\"none\"; ");
$("#tr" + node.get(index)[i]).empty();
var imgmenu = eval("img" + node.get(index)[i]);
imgmenu.src = "https://www.it610.com/article/images/ja.jpg";
}
}

}
}
}

    推荐阅读