I am not sure about when to use document.all or document.layers or
document.getElementByID. Are they all doing the same thing?
The preferred way is "document.getElementById". It is from the W3C DOM
specification.
In IE 4 and earlier, that function is not available, so you have to use
the Microsoft proprietary collection "document.all". Apart from being
a collection (so you access it as "document.all[id]" instead of calling
it as a function), it does the same thing as "document.getElementById".
In Netscape 4 and earlier, neither of these two are available. In fact,
there is no way to access an arbitrary element of a page. You can only
access elements through the available collections. Those are
document.images (<img> elements)
document.links (<a href...> and <area href...> elements)
document.ancors (<a name...> elements)
document.forms (<form> elements)
document.applets (<applet> applets)
document.embeds (<embed> elements)
document.layers (<layer> elements and elements with CSS position:absolute)
and
document.forms[...].elements (form elements in a form)
Most of these Netscape collections are also valuid W3C DOM, however
"document.layers" is not. If you are dealing with images, links, or
forms and their elements, you might as well use the collection.
/L