![]() |
|
|||
|
----------------------------------------------------------------------- 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://developer.mozilla.org/en/docs...th_the_W3C_DOM http://www.jibbering.com/faq/faq_not....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://jibbering.com/faq/index.html. The FAQ workers are a group of volunteers. The sendings of these daily posts are proficiently hosted by http://www.pair.com. |
|
|||
|
China Angered by U.S. Lobbying on Rights
Index of / |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|