Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.all[id] vs document.getElementById [id]

Status
Not open for further replies.

SimonTheSponge

Programmer
Feb 12, 2001
74
GB
Could somebody enlighten me to the differences in these functions

My understanding

document.all[id] = IE4+
document.layers[id] = NS5+
document.getElementById [id] = IE5+ and NS6+

if I want to create a crossbrowser script that refers an elememtn in a DIV or Layer Tag is it safer to use the first 2 and ingnore getElementById as I have had problems with this in older browsers

Thanks
 
My advice is don't try to develop for IE4 and NS4. Both are nearly obsolete and comprise such a small percentage of browser usage that it's not worth the effort. You'll spend 80% of your time developing for less then 5% of the browsers. There's always a better way...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top