In my script node1.data & node1.textContent are working perfectly but node1.innerHTML is not displaying anything, and I'm not getting why.
var text = [];
function getN(node1) {
    textNodesUnder(node1, text);
    return text.join("");
}
function textNodesUnder(node1, text) {
    if (node1.nodeType == 3) {
        text.push(node1.innerHTML);
        document.write(node1.textContent + "<br>");
    }
    var children = node1.childNodes;
    for (var i = 0; i < children.length; i++) {
        textNodesUnder(children[i], text);
    }
}
and
<body onload="alert('The document content is ' + getN(document))" >