ChildNodes and children

Source: Internet
Author: User

<script>
Window.onload = function () {
var Oul = document.getElementById (' ul1 ');
alert (oUl.childNodes.length);//Bounce Out is 11
alert (oUl.children.length);//Bounce Out is 3

}
</script>

<ul id= "Ul1" style= "border:1px solid red;" >
<li>11111 <span>span</span></li>
<li>22222</li>
<li>33333</li>
<li>44444</li>
<p>ppppp</p>
</ul>

element. ChildNodes: read-only attribute child node list collection

Standard: A node that contains a blank node and an element type, and also contains an illegally nested child node
Non-standard: contains only the element type of the node, IE7 the following will not contain illegal nested subnodes

ChildNodes contains only one level of child nodes and does not contain nodes below the grandchild level of the descendants

element. NodeType: Read-only property the node type of the current element

ChildNodes and children

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.