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