if(document.all)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chirs

    if(document.all)

    Hi,

    What does all mean in if(document.all )? I could not find an object
    called all in the page.

    Thanks
  • Lasse Reichstein Nielsen

    #2
    Re: if(document.all )

    yma@kicon.com (chirs) writes:
    [color=blue]
    > What does all mean in if(document.all )? I could not find an object
    > called all in the page.[/color]

    Microsoft's Internet Explorer has a proprietary property of the document
    object that is called "all".
    Writing
    if (document.all)
    tests whether this property is present.

    Some believes that the presence of document.all implies that the
    browser is IE. That is no longer the case, since some other browsers
    have also implemented it. The only thing you can really assume after
    such a check, is that document.all exists (or doesn't).

    In IE, document.all is an "HTML Collection" containing all elements
    of the page. You can write
    document.all['foo']
    to get a reference to the element with ID="foo". The offical way
    to do that is
    document.getEle mentById("foo")
    and it is supported by IE from version 5.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...