红豆蓝豆
Follow

After following, you can keep track of his dynamic information in a timely manner

Course notes
  • Courses in the relevant section:Common attributes of nodes: type, name and value

    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个赞