这个还没有写完善,你可以加工一下。
对于第三点,你可以设置一个全局变量做为标志。
以下可以做为参考
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT LANGUAGE="JavaScript">
<!--
function test1(obj)
{
   obj.bgColor="#000000";
}
function test2(obj)
{
   obj.bgColor="#ffffff";
}
function test3(obj)
{
   alert("aa");
   obj.bgColor="#ff0000";
   document.all.tr_b.bgColor="#ffffff"
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<table>
  <tr id="tr_a" bgColor="blue" onmouseover="test1(this)" onmouseout="test2(this)" onclick="test3(this)" style="cursor:hand">
  <td>aaaaaaaaaaaaaaa</td></tr>
  <tr id="tr_b" style="cursor:hand"><td>bbbbbbbbbbbbbbbbbb</td></tr>
</table>
</BODY>
</HTML>

解决方案 »

  1.   

    <script>
    function Mover(go){go.bgColor="#ebe9e0";}
    function Mout1(come){come.bgColor="#ffffff";}
    function Mout2(come){come.bgColor="#e9f4ff";}
    </script>< td bgColor="#e9f4ff" onmouseover="javascript:Mover(this)" onmouseout="Mout2(this)">baisun</td>
      

  2.   

    忘了还要说一个:
     onclick和onmouseout有点冲突,必须设置标志或参数来解决。
     因为click完,鼠标移出tr又触发了onmouseout事件。
     onmouseover的时候也有类似问题
     有什么好办法我还没有想到。应该可以加全局变量实现。
      

  3.   

    <script>
    var flag=1
    function Mover(go){if(flag==1) go.bgColor="#ebe9e0";}
    function Mout2(come){if(flag==1) come.bgColor="#e9f4ff";}
    </script>
    < td id=tr_A bgColor="#e9f4ff" onmouseover="javascript:Mover(this)" onmouseout="Mout2(this)" onclick="this.bgColor='#FF0000';document.all.tr_B.bgColor='#ffffff';flag=0;">baisun</td>
    < td id=tr_B bgColor="#e9f4ff" onmouseover="javascript:Mover(this)" onmouseout="Mout2(this)" onclick="javascript:flag=(flag==0)?1:0;">baisun</td>
      

  4.   

    onclick和onmouseout的冲突问题可以直接在定义click动作的function里接着调用mouseout的function来解决,但是我还是没搞定。
    2楼的,你说定义全局变量来做,我似乎有点眉目,可否再继续说明白点?
    还有,用你写的代码无法实现啊……
      

  5.   

    如果是说我的代码无法实现那是肯定的。
     我说了那只能作为参考的阿。
     不能光在click里调用mouseout就行了,那样,鼠标out的时候还是会有
     mouseout事件。设置颜色为全局变量,做为参数,改变参数值能解决这个问题。 我只是提出我个人的解决的思路,没有完全写出代码。见谅!
      

  6.   

    试试<body>
    <script>         
    var lock=false;
    function hi(obj){lock=false;obj.bgColor='red'}
    function ove(obj){if(!lock)obj.bgColor='black';}
    function ou(obj){if(!lock)obj.bgColor='white';}
    function hit(obj){document.all['trb'].bgColor='white';obj.bgColor='white';lock=true}
    </script><table border="1" width="100">
      <tr>
        <td width="100%" id="trb" bgcolor="red" onclick="hi(this)">b </td>
      </tr>
      <tr>
        <td width="100%" bgcolor="white" onmouseover="ove(this)" onmouseout="ou(this)" onclick="hit(this)">a </td>
      </tr>
    </table>
    </body>
      

  7.   

    fason(阿信)  的代码很接近了,但是当鼠标点击A后,其背景色并没有变成red啊;而且当点击A后,鼠标移动到B上时B的背景色也没有发生应用的变换(变成black)。
    我要求这个过程是循环的。麻烦大家再继续帮帮忙,搞定后所有人都有最少10分,不够我再加!
      

  8.   

    Namo(白色过滤嘴),你为什么不试试呢?最多加个onclick=
      

  9.   

    楼上的,你再看看代码,那个只是从A状态转移到B状态可用;但是从B状态转移到A状态也可用就不是那么简单加一段代码就可以的了……我试了一个中午了,都没搞定……而且我还想着当有不止两个单元格时也能用。
      

  10.   

    <body>
    试试
    <script>         
    var lock=false
    var h="trb"
    function ove(obj){if(obj.id==h)return;else lock=false;if(!lock)obj.bgColor='black'}
    function ou(obj){if(obj.id==h)return;else lock=false;if(!lock)obj.bgColor='white';}
    function hit(obj){lock=false;document.all(h).bgColor='white';h=obj.id;obj.bgColor='red';lock=true}
    </script><table border="1" width="100">
      <tr>
        <td width="100%" id="trb" bgcolor="red" onclick="hit(this)" onmouseover="ove(this)" onmouseout="ou(this)">b </td>
      </tr>
      <tr>
        <td width="100%" id="tra" bgcolor="white" onmouseover="ove(this)" onmouseout="ou(this)" onclick="hit(this)">a </td>
      </tr>
    </table>
    </body>
      

  11.   

    多单元格也可以
    <body>
    试试
    <script>         
    var lock=false
    var h="trb"
    function ove(obj){if(obj.id==h)return;else lock=false;if(!lock)obj.bgColor='black'}
    function ou(obj){if(obj.id==h)return;else lock=false;if(!lock)obj.bgColor='white';}
    function hit(obj){lock=false;document.all(h).bgColor='white';h=obj.id;obj.bgColor='red';lock=true}
    </script><table border="1" width="100">
      <tr>
        <td width="100%" id="trb" bgcolor="red" onclick="hit(this)" onmouseover="ove(this)" onmouseout="ou(this)">b </td>
      </tr>
      <tr>
        <td width="100%" id="tra" bgcolor="white" onmouseover="ove(this)" onmouseout="ou(this)" onclick="hit(this)">a </td>
      </tr>
        <tr>
        <td width="100%" id="trc" bgcolor="white" onmouseover="ove(this)" onmouseout="ou(this)" onclick="hit(this)">a </td>
      </tr>
          <tr>
        <td width="100%" id="trd" bgcolor="white" onmouseover="ove(this)" onmouseout="ou(this)" onclick="hit(this)">a </td>
      </tr>
    </table>
    </body>
      

  12.   

    上面写了很多没用的东西
    <body onload="init()">
    <script>         
    var h="tra"
    function init(){if(h)document.all(h).bgColor="red"}
    function ove(obj){if(!h){obj.bgColor='black';return;}if(obj.id==h)return;else obj.bgColor='black'}
    function ou(obj){if(obj.id==h)return;else obj.bgColor='white'}
    function hit(obj){if(!h)h=obj.id;lock=false;document.all(h).bgColor='white';h=obj.id;obj.bgColor='red'}
    </script>
    <table border="1" width="100">
      <tr>
        <td width="100%" id="trb" onclick="hit(this)" onmouseover="ove(this)" onmouseout="ou(this)">b </td>
      </tr>
      <tr>
        <td width="100%" id="tra"  onmouseover="ove(this)" onmouseout="ou(this)" onclick="hit(this)">a </td>
      </tr>
        <tr>
        <td width="100%" id="trc"  onmouseover="ove(this)" onmouseout="ou(this)" onclick="hit(this)">c </td>
      </tr>
          <tr>
        <td width="100%" id="trd"  onmouseover="ove(this)" onmouseout="ou(this)" onclick="hit(this)">d </td>
      </tr>
    </table>
    </body>
      

  13.   

    fason(阿信) 是强人!
    结贴!我单独开一贴,请fason(阿信)一个人来拿分!
    其余人就在这张帖子结了。