Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<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 xmlDoc = xml.responseXML;
    var x = get_lastChild(xmlDoc.getElementsByTagName("book")[0]);
    document.getElementById("demo").innerHTML =
    x.nodeName;
}
function get_lastChild(n) {
    var y = n.lastChild;
    while (y.nodeType!=1) {
        y = y.previousSibling;
    }
    return y;
}
</script>
</body>
<!-- Mirrored from www.mdssup.ma/xml/tryit.asp?filename=try_dom_nav_lastchild by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 05 Sep 2022 14:44:18 GMT -->
</html>