JavaScript-DOM编程艺术
1,document.getElementById / getElementsByClassName / getElementsByTagName
2,object.getAttribute()
object.setAttribute(attribute,value)
3,nodeType节点{元素节点:nodeType === 1
属性节点:nodeType === 2
文本节点:nodeType === 3
}
4,nodeValue
5,firstChild();lastChild()
6,open(url,name,features)方法;创建新的浏览器窗口
7,浏览器嗅探:e.target
8,键盘事件:onketpress
9,window.onload = function () {}; // 匿名函数绑定多个事件
10,用DOM动态添加script脚本:
let script = document.createElement(‘script’);
script.src = ‘www.baidu.com’;
document.head.appendChild(script);
12-02
03-26
1271
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-19
2699
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)