zoukankan      html  css  js  c++  java
  • What is the DOM?

    What is the DOM?

    When a web page is loaded, the browser creates a Document Object Model(DOM) of the page.
    The DOM defines the logical structure of the page.
    The HTML DOM is a standard for how to get, change, add, or delete HTML elements.

    The document object is the owner of all other objects in your web page.
    If you want to access objects in an HTML page, you always start with accessing the document object.

    The DOM describes the relationships of HTML elements(nodes). Element objects can have child nodes. Elements on the same node tree level are called siblings.


    1.Node Relationship

    The DOM represents a document as a tree, which is made up of parent-child relationships.

    2.Working with DOM

    In the DOM, all HTML elements are defines as objects. Objects have properties and methods. A property is a value that you can get or set(like changing the content of an HTML element).

    A method is an anction that you can do(like adding or deleting an HTML element).

    Once you have reached the node, you can access its properties.

    3.DOM EVents

    HTML DOM allows JavaScript to react to HTML events(is a object). A JavaScript can be executed when an event occurs, such as when a user clicks on an HTML element.

    When an event occurs on a target element, a handler function is executed.

  • 相关阅读:
    埃尔多安回击“穆斯林都是恐怖分子”:坏人也可能是基督徒或犹太人
    通信行业并非那么”腹黑“
    苹果无人驾驶技术专家遭大众挖角
    数据结构之数组定义及基本操作(转)
    LCD浮点数显示函数的探讨
    C 数据类型
    C 基本语法
    C 标准库
    C 语言实例
    C 语言实例
  • 原文地址:https://www.cnblogs.com/guojunru/p/5378257.html
Copyright © 2011-2022 走看看