alert(document.getElementById("floatTest").style.top);
显示为空白

解决方案 »

  1.   

    <div id="floatTest" style="top:10px"></div>
    要直接写在家 style里才会有写在 css样式里是没有的
      

  2.   

    w3c
    window.getComputedStyle(要计算的元素对象,null).marginLeft
    document.defaultView.getComputedStyle(要计算的元素对象,null).marginLeftIE:
    id.currentStyle["marginLeft"]
    对象.currentStyle["marginLeft"]
      

  3.   

    http://archive.cnblogs.com/a/1977076/
      

  4.   

    <html>
    <head>
    <title>document.getSeletion方法</title>
    </head>
    <body>
    <div id="floatTest" style="top: 10px"></div>
    <script type="text/javascript">
      alert(document.getElementById('floatTest').style.top)
      
    </script>
    </body>
    </html>
    这样可以啊