...

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



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

<code>
if(document.layers|| document.getElementById|| document.all)
</code>

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, 05: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.

chickentulip
01-10-2012, 05:44 PM
Thank you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum