The createComment() method creates a comment node.
This method returns a Comment object.
createComment(data)
The following code fragment loads "books.xml" into xmlDoc using loadXMLDoc() and adds a comment node to the <book> element:
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book'); var newComment,newtext; newtext="Revised April 2008";
for (i=0;i<x.length;i++) { newComment=xmlDoc.createComment(newtext); x[i].appendChild(newComment); }
createComment() - Create a comment node
Jump to: Top of Page or HOME or Printer friendly page
W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright 1999-2008 by Refsnes Data. All Rights Reserved.