• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 32. Version 5 DHTML: The W3C's D... > Changing the Structure of the Docume...

Changing the Structure of the Document Hierarchy

So far you've seen that the DOM enables you to control a Web page by changing aspects of the layout (the tag attributes) and the design (the tag styles). You do this by traversing the document hierarchy to the node you want to work with (most often by using the getElementById() method) and then changing the appropriate property.

However, one of the truly remarkable and unprecedented notions that the DOM brings to Web page design is that the document hierarchy itself is not set in stone. Your scripts can change the structure of the hierarchy by adding new elements or text nodes, by replacing existing nodes, or by deleting existing nodes. By utilizing just a few simple methods, your scripts become a kind of construction crew that can perform simple document touch-up jobs, major renovations, or full-scale reconstructions. This section fills you in on the details by showing you how to build an HTML table from scratch using JavaScript and the DOM.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint