不对吧,好像你第一段代码是改变行的背景,而第二段是改变单个cell的背景色,当设置了cell的背景色后,行的背景色就被遮挡了。

解决方案 »

  1.   

    把你的整个代码发上来,或者[email protected]
      

  2.   

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>Untitled Document</title>
    </head><body>
    <Script Lanuage=JavaScript>
    function ChangeRowBackGround(RowID)
        {
            var Row = document.getElementById(RowID)
            var BackGround = Row.style.background.toUpperCase();
            if (BackGround.match("#E4E8EF"))
            {
                Row.style.background = "#FFCCFF";
            }
            else
            {
                Row.style.background = "#E4E8EF";
            }
        }
      function ChangeRowBackGround2(tableid)
      {
    var rows = document.getElementById(tableid).rows;
            var len = rows.length;        for(var i=0 ;i<len; i++)
    {
       if (rows[i].cells[2].style.backgroundColor.toUpperCase().match("#E4E8EF"))
       {
                rows[i].cells[2].style.backgroundColor = "#FFCCFF";
           }
       else
       {
        rows[i].cells[2].style.backgroundColor = "#E4E8EF";
       }
            }
     }
    </Script>
    <input type="checkbox" onClick="ChangeRowBackGround2('aaa')" value="All">
    <br>
    <table width="500" border="1" cellpadding="2" cellspacing="3" bgcolor="#FFCCFF" id="aaa">
    <tr align="center" id="Row01" onClick="ChangeRowBackGround('Row01');"><td width="30">11111</td>
      <td>11111111111111111</td>
      <td>1111111111111111111111111</td>
    </tr>
    <tr align="center" id="Row02" onClick="ChangeRowBackGround('Row02');"><td>22222</td>
      <td>22222222222222222</td>
      <td>2222222222222222222222222</td>
    </tr>
    <tr align="center" id="Row03" onClick="ChangeRowBackGround('Row03');"><td>33333</td>
      <td>33333333333333333</td>
      <td>3333333333333333333333333</td>
    </tr>
    </table>
    </body>
    </html>
      

  3.   

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>Untitled Document</title>
    </head><body>
    <Script Lanuage=JavaScript>
    function ChangeRowBackGround(RowID)
        {
            var Row = document.getElementById(RowID)
            var BackGround = Row.style.background.toUpperCase();
            if (BackGround.match("#E4E8EF"))
            {
                Row.style.background = "#FFCCFF";
            }
            else
            {
                Row.style.background = "#E4E8EF";
            }
        }
      function ChangeRowBackGround2(tableid)
      {
    var rows = document.getElementById(tableid).rows;
            var len = rows.length;        for(var i=0 ;i<len; i++)
    {
       if (rows[i].cells[2].style.backgroundColor=="")
       {
                rows[i].cells[2].style.backgroundColor = "#FFCCFF";
           }
       else
       {
        rows[i].cells[2].style.removeAttribute("backgroundColor");
       }
            }
     }
    </Script>
    <input type="checkbox" onClick="ChangeRowBackGround2('aaa')" value="All">
    <br>
    <table width="500" border="1" cellpadding="2" cellspacing="3" bgcolor="#FFCCFF" id="aaa">
    <tr align="center" id="Row01" onClick="ChangeRowBackGround('Row01');"><td width="30">11111</td>
      <td>11111111111111111</td>
      <td>1111111111111111111111111</td>
    </tr>
    <tr align="center" id="Row02" onClick="ChangeRowBackGround('Row02');"><td>22222</td>
      <td>22222222222222222</td>
      <td>2222222222222222222222222</td>
    </tr>
    <tr align="center" id="Row03" onClick="ChangeRowBackGround('Row03');"><td>33333</td>
      <td>33333333333333333</td>
      <td>3333333333333333333333333</td>
    </tr>
    </table>
    </body>
      

  4.   

    更新后,全选功能失效了!
    --------
     
    是灰颜色表示选中吗?
    还以为是红颜色表示选中呢!自己改一下试试:
    line30:
    rows[i].cells[2].style.backgroundColor = "#FFCCFF";
    ----->>>>>
    rows[i].cells[2].style.backgroundColor = "#E4E8EF";
      

  5.   

    喔!我JAVASCRIPT可差劲了,ASP还可以。