如何在CSS类中获取元素的属性集

问题描述:

我想读取元素的高度和宽度.

I want to read the element's height and width.

<style type="text/css">
    .big {
        height: 100px;
        width: 100px
    }
</style>

<div id="box1" style="width:50px; height=50px;"></div>
<div id="box2" class="big"></div>

对于box01,我可以使用height=getElementById("box01").style.height-很好.

For box01 I can use height=getElementById("box01").style.height - that's fine.

但是对于box02来说,它不起作用.它什么也不返回.

But for box02 it doesn't work. It returns nothing.