bookmarks  1

  •  

    # function printDOMTree(Mid) { # var i; // for cycles # for (i=0;i<Mid.childNodes.length;i++) // go through all childs of our element # if (Mid.childNodes[i].nodeType==1) // if element # { document.write('<br />[' + Mid.childNodes[i].nodeName + ']' ); // we will write its name in [name] # printDOMTree(Mid.childNodes[i]); // and recursively run our function for this element # document.write('[/' + Mid.childNodes[i].nodeName + ']' ); // writes element name in [/name] # } # else if (Mid.childNodes[i].nodeType==3) // if it's text # { # if (Mid.childNodes[i].nodeValue=='\n') // if this text is a pagebreak symbol \n # { document.write('<br />[text:\\n]<br />' ); } // we will print it as \n just to see it in output # else # { document.write('<br />[text:' + Mid.childNodes[i].nodeValue + ']<br />' ); } // else just write the text node # } # }
    16 years ago by @bugsbunny
    (0)
     
     
  • ⟨⟨
  • 1
  • ⟩⟩

publications  

    No matching posts.
  • ⟨⟨
  • ⟩⟩