What is DOM?
The DOM is called the Document Object model and is the application interface for documents such as HTML documents and XML documents. It provides a structured document representation so that you can modify its content and final expression to connect Web pages to script goods or programming languages.
DOM function
Dom is used to access or manipulate HTML documents, node elements in an XML document that the DOM uses to create a tree to represent the document, to plan the entire page as a document made up of node levels, to give developers unprecedented control over the content and structure of the document, and to use the DOM to define objects, methods, and properties for accessing, Manipulate and create content, structure styles, and easily delete, add, and replace nodes in a document.
DOM features
DOM Classification
Core DOM, which defines a standard set of objects that can be targeted at any document.
HTML DOM, for the DOM of HTML documents, our Jiang Dom video is mainly about the content of the HTML DOM, and the details about Htmldom are covered in the next article.
XML DOM: DOM for XML documents.
The level of the DOM
DOM0: It's not a standard, it's not, it's just a historical reference point for DOM.
DOM1: Start with the rules of the consortium, focus on HTML documents and XML documents, with only one goal, which is to plan the structure of the document.
DOM2: Added support for mouse and user interface events, scopes, traversal, and added style sheet object model to DOM1.
DOM3: Added content model and document validation to DOM2
DOM tree structure
The HTML document is a tree structure, followed by a
Dom is associated with JavaScript
JavaScript can access and manipulate all elements of an HTML document through the DOM.
JavaScript is a scripting language that is used to obtain and manipulate HTML document node properties, and JavaScript uses the DOM to obtain and manipulate HTML attributes.
[HTML] view plain copy <script> function test () {Window.alert ("successful. "); } </script> <input Type=button value= "Submit" onclick= "Test ()" >
Copy the above code into a file, change it to an. html extension, open the HTML document, and click the "Submit" button to eject the "Success" dialog box.
which
The 1,2,4,5 line is JavaScript code.
Line 3rd is Dom code (this row must not be confused with JavaScript code). This is the example of JavaScript calling Dom.
Line 6th is HTML code
Note that DOM is not JavaScript-specific, and in fact many other languages implement it. However, the DOM in the Web browser has been implemented with ECMAScript and is now a big part of the JavaScript language.