XML DOM CharacterData Object

Het CharacterData-interface biedt de gebruikelijke functies van Text- en Comment-knooppunten.

Beschrijving van CharacterData-object

CharacterData is Text en Comment Het hyperinterface van de knoop. Het document bevat nooit CharacterData-knooppunten, ze bevatten alleen Text-knooppunten en Comment-knooppunten. Omdat deze twee knooppunten vergelijkbare functies hebben, zijn deze functies hier gedefinieerd, zodat Text en Comment ervan kunnen afstammen.

Note that it is not necessary to use the string operation methods defined by this interface. The data attribute is a regular JavaScript string, and you can use the + operator to perform string concatenation, and you can use various methods of the String and RegExp objects.

CharacterData object properties

Attribute Description IE F O W3C
data The text contained in this node. 6 1 9 Yes
length The number of characters contained in this node. 6 1 9 Yes

CharacterData object methods

Method Description IE F O W3C
appendData() Add the specified string to the text contained in this node. 6 1 9 Yes
deleteData() Delete the specified text from this node. 6 1 9 Yes
insertData() Insert the specified string at the specified position in the node text. 6 1 9 Yes
replaceData() Replace the specified number of text starting from the specified position with the specified string. 6 1 9 Yes
substringData() Return a text copy of the specified number of characters starting from the specified position. 6 1 9 Yes

Related pages

XML DOM Reference Manual:Comment object

XML DOM Reference Manual:Text object