DOM 属性方法用法

属性节点

attribute    getAttribute()   setAttribute()     removeAttribute()

节点类型

nodeType  元素返回1     属性返回2    文本返回3

子节点

children和childNode

outerHTLML   innerText     innerHTML

高级选项

firstChildren     lastChildren     parentNode      previousSibling      nextSibliing

oFirst=oUI.firstElementChild  ||  oUI.firstChild第一个子节点

oLast=oUI.lastElementChild  ||  oUI.lastChild最后一个子节点

兄弟节点(有兼容性)

nextSibling     nextElementSibling下一个节点

prieiousSibling    previousElementSibling上一个节点

box.insertBefore(newNode,existNode)插入新节点,注意无insetAfter方法

documentFragment(document.createDocumentFragment())  typenode=11

offsetWidth/offsetHeight//获取元素宽度,如果修改属性值用   element.style.属性名

offsetLeft/offsetTop//相对于有定位设置的包含父级对应的位置

原文地址:https://www.cnblogs.com/xiangW/p/10622347.html