While this simple topic has been discussed a ton already, some of the material out there on the net is old and in some cases hold old rebuttal comments that don’t apply anymore.
I imagine most people will find this article by searching for
document.all in Firefox. It is no longer a supported selector and does not work at all in Firefox.
The document.all selector
document.all was used back in the old days to select elements in Internet Explorer.
It did have unique features, such as being an object with helpful properties or being able to return elements by both name or id. However, you should not use name as a selector. To learn more about why you should use id as a selector, read this article.
Never use document.all
document.getElementById() in all instances instead of
document.all. It has been fully supported for well over a decade now.
While this is very basic, it is important to instill good scripting habits early on… or get rid of bad habits if you are a veteran.
By my estimates, only about 0.001% of users still have IE4, so there is absolutely positively no reason to ever use this obsolete selector.