<html>
<body>
<p id="demo"></p>
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET.html", "books.xml", true);
xhttp.send();
function myFunction(xml) {
var x, newComment, xmlDoc;
xmlDoc = xml.responseXML;
newComment = xmlDoc.createComment("Revised April 2015");
x = xmlDoc.getElementsByTagName("book")[0];
x.appendChild(newComment);
document.getElementById("demo").innerHTML = x.lastChild.nodeValue;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/xml/tryit.asp?filename=try_dom_createcomment1 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 05 Jun 2019 13:52:39 GMT -->
</html>