document.getElementById("a1").style.color; (a1是 a标签的ID)   这个JS在IE7中不支持,改成JQ也不行,请问有什么解决办法吗? 

解决方案 »

  1.   

    改正下,上面的JS为 document.getElementById("a1").style.color= "grey" 
      

  2.   

    不可能不支持,很标准的方法,颜色名称也没有问题,所有的浏览器都支持这样的方法。IE报什么错误?<a id="a1" href="#">TEST</a>
    <script type="text/javascript">
    document.getElementById('a1').style.color = 'grey';
    </script>
      

  3.   


    <head runat="server">
        <title>Untitled Page</title>    <script type="text/javascript">
         function btn()
         {
       
            document.getElementById('a1').style.color = 'grey';
            alert("1");
         }
        </script></head>
    <body>
        <form id="form1" runat="server">
        <a id="a1" href="#">TEST</a>
        <input type="button" id="btn1" onclick="btn();"   value="按钮" />
        </form>
    </body>点击按钮,页面左下角显示网页有错误 ,alert("1");也没执行。
      

  4.   

    有错吧!
    无效的属性值他不认识 grey (灰色),你改做 #ccc 就是了