There are a few DOMs. They include:

  • DOM Level 0 (DOM0) which is the de facto standard that nearly every JavaScript enabled browser supports.
  • The two intermediate DOMs
    • Internet Explorer's document.all DOM
    • Netscape 4.x's document.layers DOM
  • DOM Level 1 (DOM1)
  • DOM Level 2 (DOM2), which is an extension of DOM1
  • DOM Level 3 (DOM3), which is an extension of DOM2

You should always use DOM1+. If you want to support antique browsers that only support document.all or document.layers, then you should use something like the following.

if(document.getElementById) {
  // DOM1+ code here
} else if(document.all) {
  // code for browsers that support 
  //   document.all but not DOM1, like IE4
} else if(document.layers) {
  // code for browsers that support 
  //   document.layers but not DOM1, like NS4
}

Related Links:

Last update: 2009-10-11