What are DOM levels?

前端 未结 6 1287
感情败类
感情败类 2021-01-30 10:54

I\'ve heard DOM level 2 and DOM level 3 mentioned in previous posts. Are these abstract constructs like the ISO OSI model which has layers 1-7 but are only loosely followed?

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 11:24

    DOM, “Document Object Model” in world wide Web W3C defines a standard for accessing documents

    The W3C DOM standard is separated into 3 different parts:

    Core DOM - standard model for all document types XML DOM - standard model for XML documents HTML DOM - standard model for HTML documents You taking about JavaScript thus You need to know the HTML DOM.

    The HTML DOM is a standard object model and programming interface for HTML. It defines:

    The HTML elements as objects The properties of all HTML elements The methods to access all HTML elements The events for all HTML elements In other words: The HTML DOM is a standard for how to get, change, add, or delete HTML elements that is displayed in that window (Web Page). It has various properties that refer to other objects which allow access to and modification of document or webpage content with e.g.javascript

    For example: An HTML page has a button with an id=”txr1”.

    So how will you get the “txt1” value in JavaScript?

    document.getElementById('txt1');

    In above example, I am getting element with id=”btn1″ in javascript with the help of document element which is a DOM element.

    There are many other DOM elements which you can use in JavaScript to get and change elements of an HTML document.

提交回复
热议问题