取style可以、取class不容易吧。等待高手。

解决方案 »

  1.   

    docment.getElementById("trid").style.background
      

  2.   

    一樓説說的對阿,style容易,class不容易啊
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>testCSS</title>
    </head>
    <body>
    <span style="background-color:#006666; font-size:18px; color:#0033CC;"><span id="s1">TEST TEXT</span></span>
    <script  language="javascript">
    var v = document.getElementById("s1");

    var vStyle = v.currentStyle || document.defaultView.getComputedStyle(v,null); //兼容IE6,IE7,FireFox

    alert(vStyle.backgroundColor + "\n" + vStyle.color);
    </script>
    </body>
    </html>
      

  4.   

    都可以取到,看debugger中的quickwatch
    docment.getElementById("trid")..style.color="red";
    docment.getElementById("trid").style.background ="red";
      

  5.   

    你们在标签里用class引用css不要直接用style看看再说..