Tenth Chapter DOM

Source: Internet
Author: User

10.1 Node Hierarchy

HTML elements are represented by element nodes, and attribute nodes are represented by attribute nodes, and document type nodes are accessed through the document type nodes, which inherit a base type.

10.1.1 node type

The NodeType property indicates the type of the node

Each node has a ChildNodes property that holds a NodeList class array object, which can be converted to arrays using the Array.prototype.slice () method

The ParentNode property points to the parent node in the document tree

Previoussbling, nextSibling

AppendChild () Adds a node to the end of the ChildNodes list

Inserbefore () Places the node in a specific position in the ChildNodes list, accepting two parameters: the node to be inserted and the node to be referenced

ReplaceChild () Replaces nodes, accepts two parameters: the node to be inserted and the node to be replaced

RemoveChild () This method takes a parameter that is the node to be removed

CloneNode () accepts a Boolean parameter, True when the node and its full child node tree are copied, false when only the node itself is copied

10.1.2 doucument Type

The Document object is a property of the Windo object

Document.getelementsbytaname (), Document.getelementsbyname () will return a box of htmlcollection

10.1.3Element type

The DOM methods for manipulating properties are mainly getattribute (), SetAttribute (), RemoveAttribute (), which can be used for any of the three methods

Tenth Chapter DOM

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.