<table width="100%" border="0" cellspacing="0" cellpadding="0" onmouseover="this.bgColor='blue';" onmouseout="this.bgColor='';" onclick="this.bgColor='red';">
  <tr>
    <td>我们</td>
  </tr>
</table>

解决方案 »

  1.   

    可以:
    <table width="100%" border="0" cellspacing="0" cellpadding="0" onclick="this.bgColor='red';">
      <tr>
        <td>我们</td>
      </tr>
    </table>
      

  2.   

    function test(t) {
        for (var i=0; i<t.rows.length; i++)
        for (var j=0; j<t.rows[i].cells.length; j++)
        t.rows[i].cells[j].bgColor = t.rows[i].cells[j] == event.srcElement ? 'red' : '';
    } //参数t是table的id
    至于是鼠标进入,离开,还是点击,那是事件,各个都去调用一下,呵呵,应该不会错。
      

  3.   

    好现在这样:程序如下:
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td onmouseDown="this.bgColor='red';" onmouseover="this.bgColor='blue';" onclick="this.bgColor='red';">我们</td>
      </tr>
      <tr>
        <td onMouseDown="this.bgColor='red'" onmouseover="this.bgColor='blue';" onclick="this.bgColor='red';">你们</td>
      </tr>  
    </table>
    当点击“我们”时颜色变成绿色,但我点击“你们”时颜色变成红色,而“我们”又恢复。如何写呀!菜菜鸟!
      

  4.   

    谢谢: kingchang2000(萨那) 你的代码是我要达到的要求!谢谢