In JavaScript the document has a number of functions associated with it that can be called to directly affect the HTML document. One such function is the document.write() function. This function allows you to insert HTML code when the document loads.
We went over this before, it's how the browser loads things. The browser parses out the HTML into an internal data structure that is a tree. Well, that makes sense.
This model allows us to access any of the nodes in the tree through JavaScript. getElementById, ByTag, blah blah. We can also get the nodes and nodes down the tree at these locations, cause *GASP* everything is a node!