XML DOM replaceData() method
Definition and usage
The replaceData() method replaces the specified string Text or Comment node characters.
Syntax:
CharacterData.replaceData(start,length,string)
parameter | description |
---|---|
start | required. The character position in the Text node or Comment node to insert the string. |
length | required. The number of characters to be replaced. |
string | required. The string to be inserted. |
throw
This method can throw a DOMException with the following code DOMException exception:
INDEX_SIZE_ERR - Parameter start or length is negative, or length is greater than the length of a Text node or Comment node.
NO_MODIFICATION_ALLOWED_ERR - The node is read-only and cannot be modified.
description
This method will use the string string replacement starts from start the starting length characters. If start add length is greater than the number of characters in a Text node or Comment node, then the replacement starts from start All characters from the start to the end of the string.
Related pages
XML DOM reference manual:Text.replaceData()
XML DOM reference manual:Comment.replaceData()