
Text
Text inherits its properties and methods from CharacterData. It defines one
new method for manipulating the XML document:
splitText(offset) splits the Text object in two Text objects. The new
objects replace the existing one in the tree.
Creating a New Document with DOM
In most cases, applications use DOM to modify existing documents.
However, DOM can also create documents from scratch as Listings 9.4 and
9.5 illustrate.
Listing 9.4: HTML for Price List Creation
<HTML>
<HEAD>
<TITLE>Price List Editor</TITLE>
<SCRIPT LANGUAGE=”JavaScript” SRC=”createlist.js”></SCRIPT>
</HEAD>
<BODY>
<CENTER>
<FORM ID=”controls”>
Product name: <INPUT TYPE=”TEXT” NAME=”name”> ...