Get computed Width of an HTML Element





22
Date Submitted Fri. Aug. 18th, 2006 6:50 AM
Revision 1 of 1
Syntax Master sundaramkumar
Tags CSS | JavaScript
Comments 1 comments
Get computed Width of an HTML Element


function getComputedWidth(theElt){
        if(is_ie){
                tmphght = document.getElementById(theElt).offsetWidth;
        }
        else{
                docObj = document.getElementById(theElt);
                var tmphght1 = document.defaultView.getComputedStyle(docObj, "").getPropertyValue("width");
                tmphght = tmphght1.split('px');
                tmphght = tmphght[0];
        }
        return tmphght;
}

 

Comments

Comments Very useful
Fri. Sep. 22nd, 2006 7:07 AM    Scripter sehrgut

Voting