Q:

Why one DIV has only one child but has three child nodes?

I have two divs looks like:
<div id="responseframe">
    <div id="oldframe"> 
    </div>
</div>

I thought the #oldframe DIV is the only child of #responseframe. However, when I write this in javascript, 
    var old=document.getElementById("responseframe");
    var nodesnumber=old.childNodes.length;
    console.log("-------------Here is the nodes number of reponseframe---------: "+nodesnumber);
    var nodesname=old.childNodes[i].nodeName;
    console.log("-------------Here is the nodes name of reponseframe's child---------: "+nodesname);

console told me #responseframe has 3 child nodes and, 

childNode[0] is #text;
childNode[1] is DIV ;
childNode[2] is #text

Why there are 2 #text? Thank you for any idea.

A:

Because of you added new line after <div id="responseframe"> and after first </div>.
If you put this in one line will be there is one node: div. 
Html: 
<div id="responseframe"><div id="oldframe"></div></div>

Output:
-------------Here is the nodes number of reponseframe---------: 1 
-------------Here is the nodes name of reponseframe's child---------: DIV

Here is fiddle: http://jsfiddle.net/cassln/t7kec97u/2/

A:

Node.childNodes property returns all direct child elementNodes of parent element including textNodes, commentNodes.
So in your case you have:
<div id="responseframe"><!-- this whole space area is considered by html as single space so you got your first #text Node
    --><div id="oldframe"><!-- this area is ignored because this is not direct child area of the responseframe
    --></div><!-- this whole space area is considered by html as single space so you got your second #text Node
--></div>

So finally we got direct children: #text0 #DIV(oldframe) #text1.
If you want to get only direct elementNode (without textNodes and commentNodes) you need Node.children.
var old=document.getElementById("responseframe");
    var nodesnumber=old.children.length;
    console.log("-------------Here is the nodes number of reponseframe---------: "+nodesnumber);
    var nodesname=old.children[i].nodeName;
    console.log("-------------Here is the nodes name of reponseframe's child---------: "+nodesname);

