View Full Version : what does it mean: document.all and document.layers

01-10-2012, 06:17 PM
I found this line in one of the scripts on javascript.kit

if(document.layers|| document.getElementById|| document.all)

Could someone give me an idea on why this line would be used in a code?

Thank you very much

Philip M
01-10-2012, 06:35 PM
That is completely obsolete code.

document.layers identifies Netscape 4.
document.all identifies IE4+. (and Opera)

All modern browsers support document.getElementById

Your code is intended to test whether the browser is IE4 or Netscape 4 or better, as opposed to more ancient (and long obsolete) browsers.

Sadly Javascript Kit is not always up-to-date and contains quite a few obsolete scripts.

01-10-2012, 06:44 PM
Thank you.