--dom Learning __java of JavaScript learning texts

Source: Internet
Author: User
Tags object model
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.

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.