Latest web development tutorials

XML DOM - Comment objects

Examples

Try - Example

The following example uses XML files the Books.xml .
External JavaScript is used to load the XML file.

createComment () - Creates a comment node


Comment objects

Comment object represents the contents of the document annotation nodes.

Comment Object Properties

属性 描述
data 设置或返回此节点的文本。
length 返回此节点的文本的长度。

Comment object methods

方法 描述
appendData() 向节点追加数据。
deleteData() 从节点删除数据。
insertData() 向节点中插入数据。
replaceData() 替换节点中的数据。
substringData() 从节点中提取数据。