The Document Object Model (DOM), Part 5: More Methods
The Document Object Model (DOM), Part 5: More Methods
In the last four columns we gradually built your expertise in analyzing and synthesizing the Document Object Models of simple as well as complex documents. We taught you how to use the DOM's properties and some of its methods to manipulate documents on-line. In the last column we taught you how to replace, remove, and swap existing DOM nodes. In this column we'll switch gears and show you how to create new DOM nodes and how to add existing objects to the DOM tree.
The Document Object Model supports a rich set of methods to create and manipulate DOM nodes. We summarized these methods last column. In this column we'll explain in detail the creation-related methods. You can use the DOM's methods to create new HTML tag nodes as well as text nodes. You can also clone existing nodes to create duplicates. Once you have two new nodes, you can assign one node to be the father of another one, and vice versa. You can also insert an object into an existing DOM tree.
In particular, you'll learn:
- How to create a new HTML tag node
- How to create a new text node
- How to clone an existing node
- How to append a child to a father
- How to nominate a father to a child
- How to connect a child to a father
Produced by Yehuda Shiran and Tomer Shiran
Created: July 19, 1999
Revised: July 19, 1999
URL: https://www.webreference.com/js/column44/