DOM接口

  1. getElementById方法定义在Document.prototype上,即Element节点上不能使用。

  2. getElementsByName方法定义在HTMLDocument.prototype上,即非html中的document以外不能使用(xml document,Element)

  3. getElementsByTagName方法定义在Document.prototype 和 Element.prototype上

  4. HTMLDocument.prototype定义了一些常用的属性,body,head,分别指代HTML文档中的标签。

    document.body -> body标签

    document.head -> head标签

  5. Document.prototype上定义了documentElement属性,指代文档的根元素,在HTML文档中,他总是指代元素

    document.documentElement -> html标签

  6. getElementsByClassName、querySelectorAll、querySelector在Document,Element类中均有定义

你可能感兴趣的:(DOM接口)