window.Layer5.style.width  长
window.Layer5.style.height  高

解决方案 »

  1.   

    <div style="width:100;height:100;background-color:#d4e8ff" onclick="alert('宽:'+this.offsetWidth+'\r\n高:'+this.offsetHeight)">点击看看</div>
      

  2.   

    动态的变化,用这个也是可以的offsetWidth,不要用style.width
      

  3.   

    用getBoundingClientRect()万无一失
      

  4.   

    <script>
    function onmousedown()
    {tt=document.getelementbyid("layername");
    if tt="div"
    alert("document.layerid.style.width");
    }
    <body onclick="onmousedown()">
      

  5.   

    obj.clientWidth
    obj.clientHeight
    用这两个属性能及时准确地得知该控件的高与宽
      

  6.   

    补充楼上,这两上属性是不包括margin, border, scroll bar,padding的