JavaScript DOM编程艺术(第二版)笔记

1.CSS继承机制;

2.getElementById,getElementsByTagName,getElementsByClassName,getAttribute,setAttribute;

3.element.childNodeselement.parentNodenextSiblingpreviousSiblingchildNodesfirstChildlastChild

node.firstChildnode.childNodes[0]

node.lastChildnode.childNodes[node.childNodes.length-1]

4.node.nodeType

元素结点的nodeType属性值是1

属性节点的nodeType属性值是2

文本节点的nodeType属性值是3

5.node.nodeValue

渐进增强平稳退化

6.
function addLoadEvent(func){
        var oldonload = window.onload;
        if(typeof window.onload != 'function'){
             window.onload = func;
        }else{
             window.onload = function(){
                  oldonload();
                  func();
             }
        }
  }
7.
document.write()
node.innerHTML="<p>I inserten</p>"
createElement
appendChild
createTextNode
parentElement.insertBefore(newElement,targetElement)

dom

相关推荐