Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2010
    Location
    Toronto
    Posts
    95
    Thanks
    52
    Thanked 0 Times in 0 Posts

    what does it mean: document.all and document.layers

    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

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,985
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    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.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    chickentulip (01-10-2012)

  • #3
    New Coder
    Join Date
    Oct 2010
    Location
    Toronto
    Posts
    95
    Thanks
    52
    Thanked 0 Times in 0 Posts
    Thank you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •