Putting the following code in a page seems to make it go into an infinite
loop unless you give it a very simple node to work with. Either that or it's
very very slow. I'm somewhat new to this, having limited experience with
hacking out JavaScript but no serious coding with it. I do have programming
experience though. The logic seems fine to me. Is there something I'm
missing?
<script type="text/javascript">
var out = "";
function listNodes(node) {
out += node + "\n";
for (i = 0; i < node.childNodes .length; i++) {
listNodes(node. childNodes[i]);
}
}
listNodes(docum ent.getElementB yId("listMe"));
alert(out);
</script>
loop unless you give it a very simple node to work with. Either that or it's
very very slow. I'm somewhat new to this, having limited experience with
hacking out JavaScript but no serious coding with it. I do have programming
experience though. The logic seems fine to me. Is there something I'm
missing?
<script type="text/javascript">
var out = "";
function listNodes(node) {
out += node + "\n";
for (i = 0; i < node.childNodes .length; i++) {
listNodes(node. childNodes[i]);
}
}
listNodes(docum ent.getElementB yId("listMe"));
alert(out);
</script>
Comment