JavaScript Learning Tour (2) _ Basic knowledge

Source: Internet
Author: User
Chapter Three DOM

The DOM is the initials of the Document Object model.

Node

ELEMENT node: Is the atom of the DOM. For example: text paragraph element name p unordered list element name ul ... "NodeType property value is 1"

Text node: A text node is always contained inside an element node. "NodeType Property value is 3"

Attribute node: The attribute node is always placed in the start tag. For example: title= "A gentle Reminder" "NodeType property value is 2"



The getElementById () method returns an object



document.getElementById (ID) IDs must be placed in single or double quotes such as: document.getElementById ("purchases")



The getElementsByTagName () method returns an array of objects



getElementsByTagName (tag) tag must be (x) the name of the HTML tag and placed in double quotes such as: document.getElementsByTagName ("Li")







GetAttribute () method query properties are called by a specific object



Object.getattribute (attribute)



SetAttribute () method to set properties



Object.setattribute (Attribute,value)

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.