this is the dynamic menu of my site. it works clearly but i need a shorter and simpler function. help me pls. thanks
[CODE]
[B]XML[/B]
<root>
<m t=”1″>
<m t=”1.1″/>
<m t=”1.2″ />
<m t=”1.3″>
<m t=”1.3.1″ />
<m t=”1.3.2″ />
</m>
</m>
<m t=”2″>
<m t=”2.1″ />
</m>
<m t=”3″/>
</root>
[CODE]
[B]JS[/B]
x=x.childNodes;
for (i=0;i<x.length;i++)
{
if (x[i].nodeType==1){
txt=x[i].attributes[0];
lnk=x[i].attributes[1];
if(txt) t+=txt.nodeValue;
if(lnk) t+=”.”+lnk.nodeValue;
t+=”<br>”;
y=x[i].childNodes;
for (k=0;k<y.length;k++)
{
if (y[k].nodeType==1){
txt=y[k].attributes[0];
lnk=y[k].attributes[1];
if(txt) t+=”—“+txt.nodeValue;
if(lnk) t+=”.”+lnk.nodeValue;
t+=”<br>”;
z=y[k].childNodes;
for (j=0;j<z.length;j++)
{
if (z[j].nodeType==1){
txt=z[j].attributes[0];
lnk=z[j].attributes[1];
if(txt) t+=”———–“+txt.nodeValue;
if(lnk) t+=”.”+lnk.nodeValue;
t+=”<br>”;
}
}
}
}
}
}
[upl-file uuid=18d2decb-0348-454f-b1f6-471d40c362b7 size=6kB]m.jpg