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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What do the Script, and Styles array mean in microsoft?

    I was just skimming over again this one book, and as i was looking at the DOM picture, i noticed that in addition to the images, links, and anchor arrays, there's 2 other arrays by the names of Scripts, and Styles. How are they used?

    Secondly, whats the difference between body, and all? I mean one is an array, hence its all[], but how does it differe specifically from body? Is body only referring to the body tag of a document, while all can refer to all the tags of a file?
    LovesWar

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    In short, just about every element in a document is represented in a zero-based collection so a tag such as the P tag can be referenced using

    document.getElementsByTagName("P").length

    this will give a total of how many <P> tags are in the page.

    The script and style arrays work in the same manner although the script one I have yet to see being used.

    For the style array you would use

    document.styleSheets.length

    and then reference the rule of whichever style sheet

    document.styleSheets[0].rules[0].style.


  •  

    Posting Permissions

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