Why doesn the global variable “divId” always refer to the element with id=”divId”?
Microsoft introduced a shortcut that can be used to reference elements which include an id attribute where the id becomes a globally-accessible property. Some browsers reproduce this behavior. Some, most notably Gecko-based browsers (Netscape and Mozilla), do so only in “quirks” mode. The best approach is the document.getElementById method, which is part of the W3C DOM standard and implemented in modern browsers (including IE from version 5.0).