"JavaScript" Dom summary

Source: Internet
Author: User
Tags tag name

The DOMdocumentObjectModel, which describes a hierarchical number of nodes. D(document) is a Web document,O(object) is a window object, and so on, you can call its properties and methods;M(model) is the tree structure of a Web page document. The DOM defines the objects and attributes of the HTML element, and the way they are accessed, that is, the DOM can get, modify, add, and delete the HTML elements.

1.DOM node

The DOM treats the label as a node and understands the Web page as a node tree of nodes . There are five types of nodes : Document nodes , element nodes, text nodes, attribute nodes, annotations, and nodes. The entire document is a document node, each HTML element is an element node, the text inside the HTML element is a text node, each HTML attribute is an attribute node, and the comment is a comment node, which are all relatively easy to understand.

1) Node Properties

DOM nodes have several very useful properties:nodeName,nodetype,nodevalue.

      The NodeName property specifies the name of the node, which always contains the uppercase tag name of the HTML element, the NodeValue attribute specifies the value of the node, the NodeType property returns the type of the node, and NodeType is read-only.

2) hierarchy Node Properties

The hierarchy of nodes can be divided into: parent node and child node, sibling node, when it gets to an element node, it can get other level nodes through the Hierarchy node property.

2. Node method for the convenience of operation, the group provides some properties and methods for locating nodes, through which the DOM can create, find, delete, and so on:

These methods make it easier to manipulate web elements.

"JavaScript" Dom summary

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.