HTML Dom Learning

Source: Internet
Author: User

This document refers to the Novice tutorial: http://www.runoob.com/htmldom/htmldom-tutorial.html

Premise:

Abbreviation for DOM Document Object model

The DOM defines the criteria for accessing HTML and XML documents:

The Document Object Model (DOM) is a platform-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document. "

First, what is the HTML dom?

The HTML DOM is the standard for how to get, modify, add, or delete HTML elements.

Ii. composition of the HTML DOM (5 parts: Nodes, methods, properties, events, console objects)

2.1 Nodes

The HTML DOM expresses the HTML document in a tree structure .

HTML DOM has a five -type node structure for HTML documents:1 document nodes, 2 ELEMENT nodes, 3 attribute nodes, 4 text nodes, 5 Comment Node

2.2 Methods: manipulating ELEMENT nodes

2.3 Properties: Operations on Attribute nodes and text nodes.

2.4 Event: Here is the HTML DOM, where the DOM event is the HTML event: All events: http://www.runoob.com/jsref/dom-obj-event.html

Note: Dom attribute nodes and CSS styles are not a thing!!! action on CSS style: document.getElementById ("P2"). style

Second, what are the functions ( knowledge examples to give a few commonly used, all see the end of the article has links!!!! )

Three, sample code

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"></Head><Body><Pname= "Intro"ID= "Intro">Hello world!</P><Script>//new Element Node//var test=document.createelement ("div");//adding ELEMENT nodesvarTest=Document.createelement ("Div"); //New text node//var Node=document.createtextnode ("This is a new paragraph. ");//get element Node//var Test=document.getelementbyid ("Intro");//var test=document.getelementsbytagname ("Intro");//var test=document.getelementsbyclassname ("Intro");//alert (test);////Txt=document.getelementbyid ("Intro"). Childnodes[0].nodevalue;//document.write (TXT);</Script>

Iv. What are the various components of the HTML DOM?  ? Http://www.runoob.com/jsref/obj-console.html

HTML Dom Learning

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.