1.获取元素节点的三个方法
1.1 document.getElementById("id")
返回值是给定id属性的元素节点对应的对象;
1.2document.getElementsByTagName("p")
返回的是给定标签的一个对象数组,可以使用for循环对数组进行遍历;
document.getElementsByTagName("p").length获得长度;
1.3 document.getElementsByClassName("one")
(此方法可能在某些DOM实现中没有)
返回的也是具有相同类名的元素的一个数组,同样length也能得到数组长度,
2.属性节点
1.1 object.getAttribute(attribute);
返回值是返回的是对象的对应的属性值;
1.2object.setAttribute(attribute,value);
修改对象的对应属性值,