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. Advertisements

  2. chris

    Will Gittoes Guest

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

    and the data in the cell needs a
    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. Advertisements

  3. chris

    Denzil Guest

    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

    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

    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. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.