我用table 来显示的数据库中的数据。。 我想实现单击table 中随便一行数据   把这跳数据显示在table下面的textbox中 。。  希望各位大虾帮帮忙。。 小弟新手

解决方案 »

  1.   

    <tr onclick="ShowRowValue('..','...')">...</tr><script>
    function ShowRowValue(value1, value2)
    {
    document.getElementById('txtValue1').value=value1;
    ...
    }
    </script>
      

  2.   

    table的td加上id,用js写个单击事件。
    <table>
    <tr>
    <td id="td1" onclick="gethtml(this.id)">aaa</td>
    </tr>
    </table>
    <script>
    function gethtml(id)
    {
    var a=document.getElementById(id).innerHTML;
    alert(a);
    }//大概这样的。
    </script>
      

  3.   

    onclick="test(this);" 
    this.parentNode.parentNode.parentNode.childNodes[0].innerText
      

  4.   

    <tr onclick="test(this);" > 
    var tb=document.getElementById('table');获取表对象
    var index=this.rowIndex;获取当前行号tb.rows[index].cells[0].innerText;该行第一列文本值
    tb.rows[index].cells[1].childNodes[0].value;该行第二列第一个控件的value值
    ……
    textbox.value=……好久没写过这东西了·不知道对不·手写 估计有误差
      

  5.   

    能详细点不。 我想在textbox里显示出数据来。。 点哪一行就显示哪一行的数据