Get the size in 'px' instead of percents.

Posted by Andrei Ciobanu on Stack Overflow See other posts from Stack Overflow or by Andrei Ciobanu
Published on 2010-05-09T09:06:33Z Indexed on 2010/05/09 9:38 UTC
Read the original article Hit count: 208

Filed under:
|

Hello, I have to write a javascript function that is returning the current size (in px) of a div. Unfortunately the div has its weight specified in % instead of px.

The style of the div: position: absolute; width: 100%; height: 100%;

And my width returning function:

function getTableWidth(tableId){
    var tabWidth = document.getElementById('pt1::tabb').children[0].children[0].style.width;
    return tabWidth;
}

tabWidth is '100%'.

Is it possible to return the px width instead of the % width ?

NOTE: I don't have access to any html/css , as the page I am working on is generated through a complex framework. I can only embed javascript.

© Stack Overflow or respective owner

Related posts about css

Related posts about JavaScript