XML DOM insertData() Method
Text Object
Definition and Usage
The insertData() method inserts data into a text node.
Syntax
insertData(start,string)
| Parameters | Description |
|---|---|
| start | Required. Specifies where to start inserting characters. The starting value begins at 0. |
| string | Required. Specifies the string to insert. |
Example
The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and to the first
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("title")[0].childNodes[0];
x.insertData(0,"Cooking: ");
document.write(x.data);
Output:
Cooking: Everyday Italian
Try it »
Text Object