reading style value

Discussion in 'Javascript' started by Ward Germonpré, Dec 14, 2006.

  1. Hi,


    I know you can position an element using a style property like so :

    element.style.left=200px;

    But how can you READ an elements style.left property ?



    I want to position:fixed the columnheaders in a scrollable table an intend
    to use this strategy:

    First I dynamically construct the table, and when it's attached to the
    document, I want to read the coordinates of the columnheaders and then
    'fix' them using a different classname that I set up with 'position fixed'
    in my stylesheet.

    Can this work ?

    thx

    Ward
    Ward Germonpré, Dec 14, 2006
    #1
    1. Advertising

  2. Ward Germonpré

    Evertjan. Guest

    Ward Germonpré wrote on 14 dec 2006 in comp.lang.javascript:
    > I know you can position an element using a style property like so :
    >
    > element.style.left=200px;


    No, it should be a string!

    element.style.left='200px';

    Only usefull if the element has an absolute/relative position, methinks.

    > But how can you READ an elements style.left property ?


    alert( element.style.left );

    > I want to position:fixed the columnheaders in a scrollable table an
    > intend to use this strategy:


    eh?

    Please show a scarce example code.

    > First I dynamically construct the table, and when it's attached to the
    > document, I want to read the coordinates of the columnheaders and then
    > 'fix' them using a different classname that I set up with 'position
    > fixed' in my stylesheet.
    >
    > Can this work ?


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Dec 14, 2006
    #2
    1. Advertising

  3. Ward Germonpré

    Matt Kruse Guest

    Matt Kruse, Dec 15, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Nicholson
    Replies:
    3
    Views:
    727
    Rob Nicholson
    May 28, 2005
  2. Replies:
    0
    Views:
    2,457
  3. Replies:
    1
    Views:
    790
    Bertilo Wennergren
    Nov 24, 2003
  4. Hardeep Rakhra
    Replies:
    8
    Views:
    641
    Hardeep Rakhra
    Jan 15, 2004
  5. Ken Varn
    Replies:
    0
    Views:
    450
    Ken Varn
    Apr 26, 2004
Loading...

Share This Page