实现换颜色
<table id="tab" width=100% border="1">
<tr id="tr1" onmousedown="changecolor(this)">
<td>&nbsp;</td>
</tr>
<tr id="tr3"  onmousedown="changecolor(this)">
<td>&nbsp;</td>
</tr>
<tr id="tr4"  onmousedown="changecolor(this)">
<td>&nbsp;</td>
</tr>
<tr id="tr5"  onmousedown="changecolor(this)">
<td>&nbsp;</td>
</tr>
</table>
<script language="javascript">
var obj='';
function changecolor(trobj)
   {
    if (obj=='')
       {
        trobj.style.background="black";
       }
    else
       {        obj.style.background="white";
        trobj.style.background="black";
       }
    obj=trobj;      
   }
</script>

解决方案 »

  1.   

    选择特效
    在没行中对应加入一个hidden  选择了本行就改变hidden的值啦
      

  2.   

    <table id="iTable" onclick="test(this)">
    <tr>
    <td>aaaaaaaaaaaaaaaaaa</td>
    <td>bbbbbbbbbbbbbbbbbb</td>
    <td>cccccccccccccccccc</td>
    </tr></table>
    <script>
    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' : '';
    }
    </script>
      

  3.   

    cybernaute(思客):
    你整个程序中就没有ff0000 你怎么出来的红色?强
      

  4.   

    这样吗
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <!-- saved from url=(0027)http://sz.luohuedu.net/xml/ -->
    <HTML><HEAD><TITLE>fffffffffffffffff</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <STYLE type=text/css>BODY {
    COLOR: #ffffff
    }
    A {

    }
    </STYLE><SCRIPT language=JavaScript>
    var iopacaty =100;
    var timerid = null;
    var ImgArrNew = new Array()
    var ImgArrGold = new Array()
    for(i=1;i<4;i++)
    {
    ImgArrNew[i] = new Image();
    ImgArrNew[i].src = "tup/1"+ i + ".png"
    ImgArrGold[i] = new Image()
    ImgArrGold[i].src = "tup/21" + i + ".jif"
    }function alphaImgOver(obj1,obj2,n)
    { if(dom && !ns6_7)
    {
    document.all(obj1).src=ImgArrGold[n].src
    document.all(obj1).style.filter ="progid:DXImageTransform.Microsoft.Alpha(opacity=100)"
    document.all(obj2).style.filter ="progid:DXImageTransform.Microsoft.Alpha(opacity=100)"
    }
    if(ns6_7) document.getElementById(obj1).style.MozOpacity="99%"
    }function alphaImgOut(obj1,obj2,n)
    {
    for(j=1;j<4;j++)
    {
    if(dom && !ns6_7)
    {
    document.all(obj1).src = ImgArrNew[n].src
    document.all("img"+j).style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=40)"
    document.all("txt"+j).style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=40)"
    }
    if(ns6_7)
    {
    document.getElementById(obj1).src = ImgArrNew[n].src
    document.getElementById("img"+j).style.MozOpacity = "50%"
    document.getElementById("txt"+j).style.MozOpacity = "40%"
    }
    }
    }
    function notallAlpha()
    {
    for(i=1;i<4;i++)
    {
    if( iopacaty > 35 )
    {
    if(dom && !ns6_7)
    {
    document.all["img" + i].style.filter ="progid:DXImageTransform.Microsoft.Alpha(opacity="+iopacaty+")"
    document.all["txt" + i].style.filter ="progid:DXImageTransform.Microsoft.Alpha(opacity="+iopacaty+")"
    }
    if(ns6_7)
    {
    document.getElementById("img" + i).style.MozOpacity=iopacaty+"%"
    }
    iopacaty -= 5;
    }
    }
    }
    function Is()
    {
      var agt=navigator.userAgent.toLowerCase();
      this.major = parseInt(navigator.appVersion);
      this.minor = parseFloat(navigator.appVersion);  this.nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                  && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                  && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
      this.nav2 = (this.nav && (this.major == 2));
      this.nav3 = (this.nav && (this.major == 3));
      this.nav4 = (this.nav && (this.major == 4));
      this.nav4up = (this.nav && (this.major >= 4));
      this.navonly      = (this.nav && ((agt.indexOf(";nav") != -1) ||
                            (agt.indexOf("; nav") != -1)) );
      this.nav6 = (this.nav && (this.major == 5));
      this.nav6up = (this.nav && (this.major >= 5));
      this.gecko = (agt.indexOf('gecko') != -1);
      this.mozilla = (this.nav && (agt.indexOf('netscape') == -1));
      this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
      this.ie3    = (this.ie && (this.major < 4));
      this.ie4    = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
      this.ie4up  = (this.ie  && (this.major >= 4));
      this.ie5    = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
      this.ie5_5  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
      this.ie5up  = (this.ie  && !this.ie3 && !this.ie4);
      this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5);
      this.ie6    = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) );
      this.ie6up  = (this.ie  && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
     }
    function ShowMySite()
    {
    window.location.href="Content.asp"
    }
    function hTr(o)
    {
    oTbl = document.getElementById("tb2")
    if(oTbl == null) return
    for(i=0;i<oTbl.rows.length;i++)
    {
    if(o!=oTbl.rows[i]) oTbl.rows[i].style.display = "none"
    }
    }
    </SCRIPT><META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD>
    <BODY  onload=countTb()>
    <TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%"
    border=0>
      <TBODY>
      <TR>
        <TD height=2>
          <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
            <TBODY>
            <TR>
              <TD 
              style="FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#5A7EDC', EndColorStr='#C7DDFF')" 
              width="31%"><IMG height=2 src="" width=1></TD>
              <TD 
              style="FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#C7DDFF', EndColorStr='#5A7EDC')" 
              width="69%"><IMG height=2 src="" width=1></TD></TR></TBODY></TABLE></TD></TR>
      <TR>
        <TD bgColor=#5a7edc height="71%">
          <TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
            <TBODY>
            <TR>
              <TD width=1>
              <TD id=td0 width="50%">
                <TABLE id=tb2 cellSpacing=0 cellPadding=0 width="100%" border=0>
                  <TBODY>
                  <TR onmouseover="alphaImgOver('img1','txt1',1)" onclick=hTr(this) 
                  onmouseout="alphaImgOut('img1','txt1',1)">
                          <TD style="PADDING-LEFT: 23px; PADDING-BOTTOM: 20px" 
                      width=79><IMG id=img1 style="moz-opacity: 99%" height=32 
                      alt=http://sz.luohuedu.net/xml/ hspace=12 
                      src="../tup/1.png" width=32 border=0></TD>
                    <TD id=txt1 title="fggggggggg" 
                    vAlign=top width="100%"></TD></TR>
                  <TR onmouseover="alphaImgOver('img2','txt2',2)" onclick=hTr(this) 
                  onmouseout="alphaImgOut('img2','txt2',2)">
                          <TD style="PADDING-LEFT: 23px; PADDING-BOTTOM: 20px" 
                      width=79><IMG id=img2 
                      style="FILTER: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); moz-opacity: 99%" 
                      height=32 alt=http://dotnet.aspx.cc/ hspace=12 
                      src="../tup/1.png" width=32 border=0></TD>
                    <TD id=txt2 title="fssssscc" 
                   </TD></TR>
                  <TR onmouseover="alphaImgOver('img3','txt3',3)" onclick=hTr(this) 
                  onmouseout="alphaImgOut('img3','txt3',3)">
                          <TD style="PADDING-LEFT: 23px; PADDING-BOTTOM: 20px" 
                      width=79><IMG id=img3 
                      style="FILTER: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); moz-opacity: 99%" 
                      height=32 alt=http://lucky.myrice.com/ hspace=12 
                      src="../tup/1.png" width=32 border=0></TD>
                    <TD id=txt3 title="ccccccccccccccs" 
                    style="FONT-WEIGHT: bold; FONT-SIZE: 11pt; FILTER: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); FONT-FAMILY: 宋体,新宋体" 
                    vAlign=top width="100%"><A 
                      style="COLOR: #ffffff; TEXT-DECORATION: none" 
                      href="http://aa.ffe.com/">DHTML 
                fffffffff</A></TD></TR></TBODY></TABLE>
                <TABLE id=tb3 onmouseover=opacityNot() cellSpacing=0 cellPadding=0 
                width="100%" border=0>
                  <TBODY>
                  <TR>
                    <TD>&nbsp;</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
      
      </TBODY></TABLE>
    </BODY></HTML>
      

  5.   

    <--------------高手看过来! 能不能搞定这个?
    http://community.csdn.net/Expert/topic/3472/3472337.xml?temp=.1701624