Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the difference between dom and html?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

What is the difference between dom and html? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

Differences: 1, DOM is divided into three parts: core DOM, HTML DOM and XML DOM, core DOM is used to traverse DOM tree, HTML DOM is used to access DOM tree in a simple way; 2, core DOM is suitable for operation nodes, and HTML DOM is suitable for operation attributes.

The operating environment of this tutorial: windows10 system, HTML5 version, Dell G3 computer.

What is the difference between dom and html dom

DOM is divided into three parts:

(1) Core DOM: traversing the DOM tree, adding new nodes, deleting nodes, and modifying nodes

(2) HTML DOM: access the DOM tree in a simple way

(3) XML DOM: may be used to manipulate XML documents

The difference between Core dom and html dom

Core DOM:

Object: Document,Node, ElementNode,TextNode,AttributeNode,CommentNode,NodeList

The core DOM provides a unified operation interface:

CreateElement

AppendChild

SetAttribute

RemoveAttribute

NodeName

The core DOM creates new elements:

Var newNode=document.createElement ("img")

Add attributes to the element:

E.setAttribure (',')

E.setAttribureNode (attr)

Applicable occasions:

Core DOM is suitable for operating nodes, such as create, delete, find, etc.

HTML DOM:

Objects: objectification of image,Table,Form,Input,Select...HTML tags

HTML DOM provides various encapsulated objects:

Image

Select

Option

HTML DOM creates a new element:

Var newNode=new Image ()

Add attributes to the element:

Img.src=''

Img.id=''

Imd.title=''

Img.className=''

Img.style.display=''

Applicable occasions:

HTML DOM is suitable for manipulating attributes, such as reading or modifying the value of an attribute

This is the answer to any questions about the difference between dom and html. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report