(1)dom节点父子关系查找法
(2)document.getElementxByXxx()
(3)node.querySelector('选择器') //返回第一个
node.querySelectorAll('选择器') //返回所有
(4)几个特殊标签的快速选择法
<html>: document.documentElement
<head> : document.head
<body>: document.body
节点树vs元素树
节点树 | 元素树 |
节点有若干类型:文档、文档类型、元素、文本、注释、属性.... | 节点只有两个类型:元素(标签)、文档 |
parentNode | parentElementNode |
childNodes | children |
firstChild | firstElementChild |
lastChild | lastElementChild |
previousSibling | previousElementSibling |
nextSibling | nextElementSibling |