Après avoir suivi, vous pouvez suivre ses informations dynamiques en temps opportun
Cours dans la section correspondante:Propriétés communes des nœuds : type, nom et valeur
DOM: 元素节点、属性节点、文本节点 nodeType: 节点类型 nodeName: 节点名称 nodeValue: 节点的值 nodeType返回值: 1:元素节点 2:属性节点 3:文本节点 标签的nodeValue = null attribute: 属性 前端开发学习 例如:访问H2的属性节点 h2.attributes 返回值:NamedNodeMap{0:id,length:1} h2.attributes[0] id = "header" h2.attributes[0].nodeType 2 h2.attributes[0].nodeName "id" h2.attributes[0].nodeValue "header" h2.childNodes //返回当前元素所有的字节点 [text] h2.childNodes[0].nodeType 3 h2.childNodes[0].nodeName #text h2.childNodes[0].nodeValue "前端开发学习" 获取元素的方法: #id document.getElementById()
2022-04-060个赞
ul.childNodes[3].hasChildNodes()
2022-04-060个赞
Cours dans la section correspondante:Blocs en HTML
块级元素:<p> 内联元素:
2022-04-030个赞