当前位置:网站首页>Related concepts and operations of DOM model
Related concepts and operations of DOM model
2022-07-28 05:51:00 【Still love me】
DOM Basic concepts
Document object model (DOM,Document Object Model) Is aimed at XML But extended to HTML Application programming interface for (API,Application Programming Interface)
DOM Display and operation HTML and XML The basis of document content API, among Document -- XML file or HTML file ;Object -- Object Properties and methods of objects ;Model -- Model Model ,DOM Is aimed at XML or HTML Based on tree structure API
according to W3C DOM standard ,DOM It's a browser , platform , Language independent interfaces , It allows us to access other standard components of the page
DOM Map the whole page to a multi-layer node structure ,HTML or XML Each component of the page is a node of some kind , These nodes contain different types of data .

Core DOM The operation of
Look at the node
getElementById(); By element id Value to view
getElementsByName(); Of the query element name attribute
getElementByTagName(); Returns a collection of objects with the specified label name
The parent node finds the child node
Find child node objects through parent node objects ( There may be text nodes ) Compatibility is good.
Parent node object .firstChild Find the first child node under the parent node
Parent node object .lastChild Find the last child node under the parent node
Parent node object .childNodes Multiple Find all child nodes under the parent node
Find the child element node object through the parent node object
Parent node object .firstElementChild Find the first child element node under the parent node
Parent node object .lastElementChild Find the last child element node under the parent node
Parent node object .children Multiple Find all child element nodes under the parent node
The child node finds the parent node
Child node object .parentNode Find the parent node through the child node
Child node object .parentElement Find parent elements through child nodes
Search between brothers
.nextSibling Find the next sibling May be text
.nextElementSibling Find the next element sibling node
.previousSibling Find the last sibling May be text
.previousElementSibling Find the sibling node of the previous element
Node object
Node object .getAttribute(" Property name ") Get the property value according to the property name
Node object .setAttribute(" Property name "," Property value ")
Node object .removeAttribute(" Property name ") Delete the corresponding pair of genera
边栏推荐
猜你喜欢

js-宏任务和微任务

Thinking on Architecture Design (SSO design)

Help document making based on easy CHM and vs

(PHP graduation project) obtained based on PHP student homework submission management system

书籍-乌合之众

Making E-R diagram based on XMIND

正则表达式

蓝桥代码 翻硬币(我这样写也通过了,官网测试是不是有问题)

DOM--事件链、事件冒泡和捕获、事件代理

(php毕业设计)基于php小说网站管理系统获取
随机推荐
Time setting in curd component
(php毕业设计)基于php校园网络报修管理系统获取
分支与循环语句
ArcMap连接表格(Join)相关问题整理
Review of metallurgical physical chemistry -- rate equations of complex reactions
Distance toolbar in ArcMap (distance)
Set scroll bar
On a wonderful journey
基于Highcharts平台的桑基图(Sankey diagram)绘制
(PHP graduation project) obtained based on PHP student homework submission management system
简单几步实现小程序分享朋友圈
Add the corresponding subscripts of multiple arrays in the object
js-宏任务和微任务
ArcGIS之Model Builder
设置滚动条
初学移动端
Microsoft Edge浏览器插件(1)
ArcGIS Engine Development Resources
Sorting out problems related to ArcMap join table
Zotero - a document management tool