1 2 window.addEventListener('load', function(event){3 4 var o = document.getElementById('cuadrado');5 var i = document.getElementById('info');6 7 i.innerHTML = listChildren(o, '');8 9 }, true);10 11 12 function listChildren(o, t) {13 var s = '';14 var c = o.childNodes;15 s += '<ul>';16 for (key in c) {17 var a = c[key];18 if (a.nodeType == 1) {19 s += '<li>' + a.tagName + '</li>';20 s += listChildren(a, t+'\t');21 }22 }23 s += '</ul>';24 return s;25 }
Enlace
El enlace para compartir es: