Reply LinkBack Thread Tools Search this Thread
Old 08-05-2008, 16:55   #1 (permalink)
hyperzzzz
Registered User
 
Join Date: Mar 2008
Posts: 23
get element by id & get document.all

Hi I need to find some information on the two things in the thread title. Ive had a little search around but nothing really explains the two properly.

Thanks if you can explain it or have a decent link =]
  Reply With Quote
Old 08-05-2008, 16:57   #2 (permalink)
pgo
Moderator
 
pgo's Avatar
 
Join Date: Jan 2005
Location: Brooklyn, NYC
Posts: 11,869
document.getElementById is a standard W3C DOM method for finding an element by ... get ready ... its ID.

document.all is bad, bad, bad.
__________________
  Reply With Quote
Old 15-05-2008, 16:10   #3 (permalink)
KarateRobot
Registered User
 
KarateRobot's Avatar
 
Join Date: May 2008
Location: Seattle
Posts: 9
pgo said it, I'll just throw out some notes:

document.all is a reaaaaally old and outdated method of grabbing something in the page. getElementById does the same thing, but is now the preferred method, and is part of the standard, so it will continue to be supported well into the future, whereas document.all won't be.

For getElementById, The ID in question is the HTML attribute "ID", which can be applied to almost every element. It's meant to be a unique identifier, so if (heaven forbid) you had two elements with the same ID, it should only ever return the first one on the page.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8