<table>
<tr>
<td onmouseover="this.bgColor='#f2f2f2'" onmouseout="this.bgColor=''">a</td><td>aa</td>
</tr>
<tr>
<td>b</td><td>bb></td>
</tr>
</table>

解决方案 »

  1.   

    <table border=1>
    <tr onmouseover="over(this)" onmouseout="out(this)">
    <td>a</td><td>aa</td>
    </tr>
    <tr onmouseover="over(this)" onmouseout="out(this)">
    <td>b</td><td>bb</td>
    </tr>
    </table><script language="JavaScript"><!--
    function over(e)
    {
        e.bgColor = "#FF0000";
    }
    function out(e)
    {
        e.bgColor = "";
    }//--></script>
      

  2.   

    可以自己做一个keypress程序,捕获键盘事件,用id号表示<td id=t1..>
    其它的我想就不用说了。
      

  3.   

    <table border=1>
    <tr onmouseover="over(this)" onmouseout="out(this)">
    <td><input type=button value="aaa"</td><td>aa</td>
    </tr>
    <tr onmouseover="over(this)" onmouseout="out(this)">
    <td><input type=button value="bbb"></td><td>bb</td>
    </tr>
    </table><script language="JavaScript"><!--
    function over(e)
    {
        e.bgColor = "#FF0000";
    }
    function out(e)
    {
        e.bgColor = "";
    }//--></script>
    各位老师:我的意思是,如果按动键盘的上下键,就能从上一行的<input>切换到下行的<input>上,当在变色的这一行上按下回车键后就能做提交,通过鼠标点击是能实现的了,关键是用键盘该怎么实现
      

  4.   

    <body onload="lastobj=document.all.tr1;over(document.all.tr1)">
    <table border=1>
    <tr id=tr1 onmouseover="over(this)" onmouseout="out(this)">
    <td>a</td><td>aa</td>
    </tr>
    <tr id=tr2 onmouseover="over(this)" onmouseout="out(this)">
    <td>b</td><td>bb</td>
    </tr>
    <tr id=tr3 onmouseover="over(this)" onmouseout="out(this)">
    <td>c</td><td>cc</td>
    </tr>
    <tr id=tr4 onmouseover="over(this)" onmouseout="out(this)">
    <td>d</td><td>dd</td>
    </tr>
    </table><script language="JavaScript">
    lastobj="";
    function document.onkeydown()
    {
    if(event.keyCode==38)
    {
    if(lastobj.id!="tr1")
    {
    eval("over(document.all.tr"+(lastobj.id.substring(2,3)-1)+");");
    }
    }
    else if(event.keyCode==40)
    {
    try
    {
    eval("over(document.all.tr"+(lastobj.id.substring(2,3)-1+2)+");");
    }
    catch(e)
    {
    over(lastobj);
    }
    }
    }
    function over(e)
    {
        lastobj.bgColor = "";
        e.bgColor = "#FF0000";
        lastobj=e;
    }
    function out(e)
    {
        e.bgColor = "";
        lastobj=e;
    }
    </script>