In-depth analysis of the DOM model in JavaScript (6)

Source: Internet
Author: User

Dom is a structured object model that provides a common access method for tag objects. html files are considered as a node tree. Each label and text is a node and can access each node and node content.

In this way, you can access HTML content through the methods and interfaces provided by Dom, without the need to query individual elements one by one.

Advantages:

Cross-platform and program language program Interfaces

Dom provides a standard program processing interface for the application environment, which is a standard API for HTML and XML files and can exchange data over the network.

Supports multiple file formats

Supports multiple programming languages

Dom provides several attributes to easily access nodes in the tree structure. As follows:

Take parentnode, childnodes, and previussibling as examples.

<HTML xmlns = "http://www.w3.org/1999/xhtml"> 

Click the three radio buttons to obtain the following results:


Obtain the parent, child, and sibling tags of the current tag, you can use these simple methods to add, delete, modify, and query elements in the DOM document model and operate Dom documents.

To be continued ......

 

 

 

 

 

 

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.