XML DOM replaceData() method

Definition and usage

The replaceData() method replaces the specified string Text or Comment characters of the node.

Syntax:

CharacterData.replaceData(start,length,string)
Parameter description
start Required. The character position in the Text node or Comment node where the string is to be inserted.
length Required. The number of characters to be replaced.
string Required. The string to be inserted.

thrown

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 start length characters. If start plus 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()