There's a little problem with the computed style of font sizes, though - while IE will return the font size in the measurements in the css (in this case in em) firefox and Chrome actually compute its size and return that in px
Not that I'm offering a solution or anything. Just thought I'd point that out
Code:
<html>
<head>
<style type="text/css">
#foo {font-size:1em;}
</style>
</head>
<body>
<div id="foo">hello</div>
<script type="text/javascript">
function getStyle(el, cssprop){
if (el.currentStyle) //IE
return el.currentStyle[cssprop]
else if (document.defaultView && document.defaultView.getComputedStyle) //Firefox
return document.defaultView.getComputedStyle(el, "")[cssprop]
else //try and get inline style
return el.style[cssprop]
}
var bar = document.getElementById("foo");
bar.style.fontSize = "4em"
alert(getStyle(bar, "fontSize")); // displays in px in FF and Chrome, in em in IE
</script>
</body>
</html>