Parse firstChild, an array element of the children object in the dom. lastChild's _ javascript skills

Source: Internet
Author: User
The following is a detailed analysis of the use of the firstChild and lastChild elements of the children object array in dom. For more information, see The Code is as follows:









Row 1 column 1 Row 1 column 2
Row 2 column 1 Row 2 column 2









Script
Alert (test. children [0]. tagName)
Alert (test. children [1]. tagName)
Script


Document. all. tbl. children (0). children (0). Explanation of innerHTML
Document. all. tbl. children (0) locates the first subnode of the table.
Document. all. tbl. children (0). children (0) locates the first subnode of the first subnode of the table., Print the resultRow 1 column 1Row 1 column 2


Document. all. tbl. children (0). children (1). innerHTML, print the resultRow 2 column 1Row 2 column 2


Document. all. tbl. children (0). children (1). children (0). innerHTML prints the result row, 2 columns, and 2 columns.







Row 2 column 1

Row 1 column 1 Row 1 column 2
Row 2 column 2









Script
Alert (test. firstChild. tagName)
Alert (test. lastChild. tagName)
Script


Document. all. tbl. firstChild locates the first subnode of the table.
Document. all. tbl. firstChild. firstChild locates the first subnode of the table.
The first subnode
Document. all. tbl. firstChild. firstChild. innerHTML:Row 1 column 1Row 1 column 2


Document. all. tbl. firstChild. lastChild locates the first subnode of the table.
The last sub-node
Document. all. tbl. firstChild. lastChild. innerHTML: Row 2 column 1Row 2 column 2


Document. all. tbl. firstChild. lastChild. firstChild. innerHTML:
Row 2 column 2

Related Article

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.