F
FAQ server
-----------------------------------------------------------------------
FAQ Topic - Why doesn't 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
global variable. Some browsers reproduce this behaviours but
some, most notably Gecko-based browsers (Netscape and Mozilla),
do not. 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). So an
element with « id="foo" » can be referenced
with:-
var el = document.getElementById("foo");
http://www.mozilla.org/docs/web-developer/upgrade_2.html#dom_access
http://www.jibbering.com/faq/faq_notes/faq_notes.html#FAQN4_41
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://www.jibbering.com/faq/.
The FAQ workers are a group of volunteers.
FAQ Topic - Why doesn't 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
global variable. Some browsers reproduce this behaviours but
some, most notably Gecko-based browsers (Netscape and Mozilla),
do not. 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). So an
element with « id="foo" » can be referenced
with:-
var el = document.getElementById("foo");
http://www.mozilla.org/docs/web-developer/upgrade_2.html#dom_access
http://www.jibbering.com/faq/faq_notes/faq_notes.html#FAQN4_41
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://www.jibbering.com/faq/.
The FAQ workers are a group of volunteers.