document.all.x.style.backgroundColor="#EEEEEE";

解决方案 »

  1.   

    x.style["background-color"]="#ffffff"
    这个为什么不行?
      

  2.   

    脚本对象属性和CSS样式不一样吧
    backgroundColor
    DescriptionSets or retrieves the background color of an element. Syntax
    object.style.backgroundColor[ = backgroundColor]
      

  3.   

    JavaScript中的CSS性质许多CSS样式性质的名字中都有连字符,如 font-family
    在JavaScript中,连字符被解释为减号.所以不能编写下列表达式:
    element.style.font-family = "sans-serif"; //错的
    element.style.fontFamily = "sans-serif"; //正确而没有这种写法.x.style["background-color"]="#ffffff"