Change Language


Follow Navioo On Twitter

Comment : CharacterData

Represents a comment in a XML/HTML document.

Platform Support

IE Mozilla Netscape Opera Safari
no 1.0+ no 7.0+ 1.0+

Constructors

Constructor Action IE Mozilla Netscape Opera Safari
Comment Constructor() : Comment
Represents a comment in a XML/HTML document.
Show Details no 1.0+ no 7.0+ 1.0+

Comment() : Comment

Represents a comment in a XML/HTML document.

Returns

Comment
Visibility
internal

Inherited Properties

Property Action IE Mozilla Netscape Opera Safari
data : String
Character data of the current node.
Show Details no 1.0+ no 7.0+ 1.0+
Remarks
The data property does not have a size limitation, but data is subject to the limitations of the size of a String object. If the content data is too large, use substringData to retrieve the character data in chunks.
Availability

HTML DOM Level 2|W3C

length : Number
Length of the content of the data property or substringData method.
Show Details no 1.0+ no 7.0+ 1.0+
Remarks
Length of the content available from the data property or the substringData method. If the content of data is empty, the value of length will be zero.
Availability

HTML DOM Level 2|W3C

Inherited Functions

Method Action IE Mozilla Netscape Opera Safari
appendData(String arg) : void
Appends the specified string to the node text.
Show Details 6.0+ 1.0+ no 7.0+ 1.0+

Parameters

String arg String to append.

Returns

void

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/dhtml/Node_Operation_978.dhtml

Remarks
Appends the specified string to the end of the current character data content, which will then be available through the data property.
Throws
Raises a NO_MODIFICATION_ALLOWED error if the node is read-only.
See Also

CharacterData.deleteData|CharacterData.insertData|CharacterData.replaceData

Availability

HTML DOM Level 2|W3C

deleteData(Number offset, Number count) : void
Deletes the indicated range of text.
Show Details 6.0+ 1.0+ no 7.0+ 1.0+

Parameters

Number offset Character offset inside the content from which to start deleting.
Number count Number of characters to delete. If the range of characters is greater than the length of the content of the node, then all characters from offset to the end of the string are deleted.

Returns

void

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/dhtml/Node_Operation_978.dhtml

Remarks
Removes the specified range of characters from content of the node and shifts any remaining text downward. if the characters are successfully deleted, updates the properties of the node to indicate the new content and size.
Throws
Raises a NO_MODIFICATION_ALLOWED error if the node is read-only.
Raises an INDEX_SIZE_ERR error if either the offset or count is negative or if offset is greater than the length of the Text or Comment.
See Also

CharacterData.appendData|CharacterData.insertData|CharacterData.replaceData

Availability

HTML DOM Level 2|W3C

insertData(Number offset, String arg) : void
Inserts the supplied text at the indicated character offset
Show Details 6.0+ 1.0+ no 7.0+ 1.0+

Parameters

Number offset Character offset inside the content at which to insert the new string.
String arg String to insert.

Returns

void

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/dhtml/Node_Operation_978.dhtml

Remarks
Performs the opposite of deleteData.
Throws
Raises a NO_MODIFICATION_ALLOWED error if the node is read-only.
Raises an INDEX_SIZE_ERR if either the offset or count is negative or if offset is greater than the length of the Text or Comment.
See Also

CharacterData.appendData|CharacterData.deleteData|CharacterData.replaceData

Availability

HTML DOM Level 2|W3C

replaceData(Number offset, Number count, String arg) : void
Substitutes the indicated range of text with the supplied string
Show Details 6.0+ 1.0+ no 8.0+ 1.0+

Parameters

Number offset Character offset inside the content at which to start the replacement.
Number count Number of characters to replace. If the range of characters is greater than the length of the content of the node, all characters from offset to the end of the string are replaced.
String arg Text string to replace the specified range.

Returns

void

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/dhtml/Node_Operation_978.dhtml

Remarks
Replaces a specific range of text within the content of the node with the supplied string. Equivilant to invoking deleteData, followed by insertData using the same offset.
Throws
Raises a NO_MODIFICATION_ALLOWED error if the node is read-only.
Raises an INDEX_SIZE_ERR error if either the offset or count is negative or if offset is greater than the length of the Text or Comment.
See Also

CharacterData.appendData|CharacterData.deleteData|CharacterData.insertData

Availability

HTML DOM Level 2|W3C

Remarks

Represents the contents of an HTML or XML comment, which begins with the token <!-- and ends with -->. The contents of this node are any characters that exist between those two tokens.

Comment inherits its capabilities from CharacterData. See CharacterData for more information on the methods and properties available via the Comment object.

References

CharacterData

Availability

HTML DOM Level 2|W3C

text_javascript Navioo_docs

Examples -> Source code Demo online - > comment:

Ajax Javascript feed

↑ Grab this Headline Animator