XML DOM splitText () method
Definition and Usage
splitText () method in accordance with the specified offset the text node into two nodes.
This function returns the text node contains the offset later.
Before offset of the text remains in the original text node.
grammar
replaceData(offset)
参数 | 描述 |
---|---|
offset | 必需。规定在何处分割文本节点。偏移值以 0 开始。 |
Examples
The following code fragment uses loadXMLDoc () to " books_cdata.xml " into xmlDoc, and split text in a CDATA section node:
Examples
xmlDoc=loadXMLDoc("books_cdata.xml");
x=xmlDoc.getElementsByTagName("html")[0].childNodes[0];
y=x.splitText(8);
document.write(x.nodeValue);
document.write("
");
document.write(y.nodeValue);
x=xmlDoc.getElementsByTagName("html")[0].childNodes[0];
y=x.splitText(8);
document.write(x.nodeValue);
document.write("
");
document.write(y.nodeValue);
Output:
Stunn
ing!
ing!
try it"
CDATA objects