Are style properties held in an array?

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

    Are style properties held in an array?

    Just learning here, so maybe I'm way off, but...
    I was originally under the impression that css style properties could
    be accessed/ listed since they exsisted as an array somewhere.

    Is this just flat out wrong?

    To illustrate - I guess I thought something like this could be used to
    list available/ or set properties, or in this example the first
    property. Is this just a fantasy? Or how does this work, at this level
    or for document objects even?

    //assuming <div id="menu"></div> exisists and hs styles applied....

    document.write( document.getEle mentById('menu' ).style[0]);

    //of course this is wrong...
  • Martin Honnen

    #2
    Re: Are style properties held in an array?



    Nairb wrote:[color=blue]
    > Just learning here, so maybe I'm way off, but...
    > I was originally under the impression that css style properties could
    > be accessed/ listed since they exsisted as an array somewhere.
    >
    > Is this just flat out wrong?
    >
    > To illustrate - I guess I thought something like this could be used to
    > list available/ or set properties, or in this example the first
    > property. Is this just a fantasy? Or how does this work, at this level
    > or for document objects even?
    >
    > //assuming <div id="menu"></div> exisists and hs styles applied....
    >
    > document.write( document.getEle mentById('menu' ).style[0]);[/color]

    DOM Level 2 style defines the style object property to have its own
    property named length and to have an item method which in the ECMAScript
    binding can be called by using square bracket indexing.
    Netscape 6+ and Opera 7 implement it this way, however IE5/6 don't
    provide the length property nor the item method.
    Anway, in your example (<div id="menu"></div>) there is no inline style
    thus the length property would be zero.



    --

    Martin Honnen


    Comment

    Working...