---
title: "JavaScript DOM编程艺术（第二版）笔记"
author: "xiaotongeye"
date: "2018-05-22T17:38:26Z"
tags: []
categories: ["Web前端"]
slug: "javascript-dom"
draft: false
lastmod: "2018-05-22T19:32:44Z"
id: 2423311
url: "https://xiaotongeye.iteye.com/blog/2423311"
---

1.CSS继承机制;
2.getElementById,getElementsByTagName,getElementsByClassName,getAttribute,setAttribute;
3.element.childNodes element.parentNode nextSibling previousSibling childNodes firstChild lastChild
   node.firstChild  node.childNodes
   node.lastChild   node.childNodes
4.node.nodeType
   元素结点的nodeType属性值是1
   属性节点的nodeType属性值是2
   文本节点的nodeType属性值是3
5.node.nodeValue
   渐进增强  平稳退化
6.
```javascript

   function addLoadEvent(func){
        var oldonload = window.onload;
        if(typeof window.onload != 'function'){
             window.onload = func;
        }else{
             window.onload = function(){
                  oldonload();
                  func();
             }
        }
  }

```

7.
```javascript

document.write()
node.innerHTML="<p>I inserten</p>"
createElement
appendChild
createTextNode
parentElement.insertBefore(newElement,targetElement)

```