get the size of a table or cell

Discussion in 'HTML' started by chris, Aug 17, 2004.

  1. chris

    chris Guest

    is there a way by using html or javascript or anything else for that matter
    to detirmine the actual height or width of a table or cell

    for example if i only set the height to 100 and the data in the cell needs a
    higher cell it expands to suit - i want to find out what the actual height
    ends up ??

    thanks for your help

    chris
    chris, Aug 17, 2004
    #1
    1. Advertising

  2. chris

    Will Gittoes Guest

    chris wrote:
    > is there a way by using html or javascript or anything else for that matter
    > to detirmine the actual height or width of a table or cell
    >
    > for example if i only set the height to 100


    Make sure you tell it if this is 100 PIXELS (px), PERCENT (%) etc...
    This is important!

    and the data in the cell needs a
    > higher cell it expands to suit - i want to find out what the actual height
    > ends up ??
    >
    > thanks for your help
    >
    > chris
    >
    >


    No, not that I know of, sorry. Annoying, isn't it?

    Just work around it; use good code, learn CSS (http://www.webmonkey.com)
    and you can have per-pixel accuracy over your pages anyway.
    Will Gittoes, Aug 17, 2004
    #2
    1. Advertising

  3. chris

    Denzil Guest

    "chris" wrote in message news:
    > is there a way by using html or javascript or anything else for that matter
    > to detirmine the actual height or width of a table or cell


    Hi,

    The following link from MSDN gives all the DHTML Object Model
    properties that are related to the dimension and location of elements.
    Worth a see.

    [Measuring Element Dimension and Location]
    http://msdn.microsoft.com/library/d...r/dhtml/reference/properties/clientheight.asp

    Cheerz,
    Denzil
    Denzil, Aug 17, 2004
    #3
  4. chris

    Denzil Guest

    Denzil, Aug 18, 2004
    #4
  5. chris

    noone Guest

    "Will Gittoes" <> skrev i en meddelelse
    news:1092735001.91079@ftpsrv1...
    > chris wrote:
    > > is there a way by using html or javascript or anything else for that

    matter
    > > to detirmine the actual height or width of a table or cell
    > >
    > > for example if i only set the height to 100

    >
    > Make sure you tell it if this is 100 PIXELS (px), PERCENT (%) etc...
    > This is important!
    >
    > and the data in the cell needs a
    > > higher cell it expands to suit - i want to find out what the actual

    height
    > > ends up ??
    > >
    > > thanks for your help
    > >
    > > chris
    > >
    > >

    >
    > No, not that I know of, sorry. Annoying, isn't it?


    Actually, if you can set a property, then you can also read a property.
    Anything else wouldn't make much sense.

    Robert
    noone, Aug 20, 2004
    #5
  6. chris

    Will Gittoes Guest

    noone wrote:
    > "Will Gittoes" <> skrev i en meddelelse
    > news:1092735001.91079@ftpsrv1...
    >
    >>chris wrote:
    >>
    >>>is there a way by using html or javascript or anything else for that

    >
    > matter
    >
    >>>to detirmine the actual height or width of a table or cell
    >>>
    >>>for example if i only set the height to 100

    >>
    >>Make sure you tell it if this is 100 PIXELS (px), PERCENT (%) etc...
    >>This is important!
    >>
    >>and the data in the cell needs a
    >>
    >>>higher cell it expands to suit - i want to find out what the actual

    >
    > height
    >
    >>>ends up ??
    >>>
    >>>thanks for your help
    >>>
    >>>chris
    >>>
    >>>

    >>
    >>No, not that I know of, sorry. Annoying, isn't it?

    >
    >
    > Actually, if you can set a property, then you can also read a property.
    > Anything else wouldn't make much sense.
    >
    > Robert
    >
    >


    But that merely reads back the property you set!

    If you did something in Javascript such as:
    element_name = document.getElementById("ElementName");
    element_name.style.height="50px"

    If you then do this:
    alert(element_name.style.height);
    You will get 50px - no matter WHAT size it has actually been rendered
    (i.e. not taking into account a giant image in the element etc.).
    Will Gittoes, Aug 20, 2004
    #6
    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. Bill
    Replies:
    6
    Views:
    516
  2. Mike

    Table cell bgcolor size ?

    Mike, Oct 29, 2003, in forum: HTML
    Replies:
    2
    Views:
    722
    Jukka K. Korpela
    Oct 29, 2003
  3. Phillip Roncoroni
    Replies:
    14
    Views:
    1,086
    Toby A Inkster
    Apr 5, 2004
  4. John Dalberg
    Replies:
    4
    Views:
    784
  5. chris

    get the size of a table or cell

    chris, Aug 17, 2004, in forum: Javascript
    Replies:
    4
    Views:
    112
    noone
    Aug 20, 2004
Loading...

Share This Page