就是说像google中那样,能匹配搜索的字符用小键盘上的上、下键移动付给文本输入框

解决方案 »

  1.   

    只要得到tbody中的td的文本就行。请教!
      

  2.   

    在当前项,使用onkeyup,对输入的键进行判断,如果是按下上或者下键的话,使上或者下行选中.
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Bug</title>
    <script>
    var tdIndex = 1;
    function change(){
    if(event.keyCode==40){
    tdIndex+=1; eval("document.all.td"+tdIndex+".style.backgroundColor='#3366aa'");
    document.all.txt.value = eval("document.all.td"+tdIndex+".innerText");
    }//down }

    </script>
    </head>
    <body onkeydown="change()" >
    <table border='1' bordercolor="#FFFFFF">
    <tr>
    <td id="td1">one</td>
    </tr>
    <tr>
    <td id="td2">two</td>
    </tr>
    <tr>
    <td id="td3">three</td>
    </tr>
    <tr>
    <td id="td4">four</td>
    </tr>
    <tr>
    <td id="td5">five</td>
    </tr>
    </table>
    <input type="text" value="" id="txt">
    </body>
    </html>没时间了 做了一下 你参考完成以后的吧 
      

  4.   


    <html>
    <head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <script language="javascript">
    window.document.onkeydown=test;
    function $(o)
    {
    return document.getElementById(o);
    }

    var currentFocus={y:0};
    function test()
    {
    if(event.keyCode==38 && currentFocus.y>0)
    {
    currentFocus.y--;
    }
    if(event.keyCode==40 && currentFocus.y<$("table1").rows.length-1)
    {
    currentFocus.y++;
    }

    for(i=0;i<$("table1").rows.length;i++)
    {
    var tempBgColor=$("table1").rows[i].cells[0].bgColor
    if(i==currentFocus.y)
    {
    $("table1").rows[i].cells[0].bgColor="#00ff00";
    }
    else
    {
    $("table1").rows[i].cells[0].bgColor="";
    }
    }
    $("input1").value=$("table1").rows[currentFocus.y].cells[0].innerText; }
    </script>
    </head>
    <body>
    <table border="1" width="100%" id="table1" height="320">
    <tr>
    <td style="width:33%;"> 123123</td>
    <tr>
    <td style="width:33%;"> asdfasdfa</td>
    </tr>
    <tr>
    <td style="width:33%;"> baa2424234234</td>
    </tr>
    </table>
    <input type="text" id="input1">
    </body>
    </html>
    是这种效果吗?