HighDots Forums  

FAQ Topic - Why doesn't the global variable "divId" always refer to the element with id="divId"? (2008-05-26)

Javascript JavaScript language (comp.lang.javascript)


Discuss FAQ Topic - Why doesn't the global variable "divId" always refer to the element with id="divId"? (2008-05-26) in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
FAQ server
 
Posts: n/a

Default FAQ Topic - Why doesn't the global variable "divId" always refer to the element with id="divId"? (2008-05-26) - 05-25-2008 , 07:00 PM






-----------------------------------------------------------------------
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.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.