<table><tr><td onclick='a.value=this.innerText'>name</td><td onclick='b.value=this.innerText'>sex</td><td onclick='c.value=this.innerText'>birthday</td></tr></table>
<input name="a">
<input name="b">
<input name="c">

解决方案 »

  1.   

    <table><tr onclick="aa(this)"><td>name</td><td>sex</td><td>birthday</td></tr></table>
    <input name="a">
    <input name="b">
    <input name="c">
    <script>
    function aa(o)
    {
    a.value=o.cells(0).innerText
    b.value=o.cells(1).innerText
    c.value=o.cells(2).innerText
    }
    </script>
      

  2.   

    <table onclick="aa()" border=1>
    <tr><td>name1</td><td>sex1</td><td>birthday</td></tr>
    <tr><td>name2</td><td>sex2</td><td>birthday</td></tr>
    <tr><td>name3</td><td>sex3</td><td>birthday</td></tr>
    </table>
    <input name="a">
    <input name="b">
    <input name="c">
    <script>
    function aa()
    {
    o=event.srcElement
    if(o.tagName=="TABLE" || o.tagName=="TBODY")
    return
    while(o.tagName!="TR")
    {
    o=o.parentElement
    }
    a.value=o.cells(0).innerText
    b.value=o.cells(1).innerText
    c.value=o.cells(2).innerText
    }
    </script>
      

  3.   

    在表格里点击一下,该格的值就放到同一页面的一个文本框内:
    <html>
    <body>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function showinput()
    {
    elm = event.srcElement;
    if (elm.tagName != "TD") return;
    document.all.tablecell.value=elm.innerText;
    }
    //-->
    </SCRIPT>
    <TABLE border=1 height=100>
    <thead id=thead1>
    <tr>
    <th></th>
    <th width=100></th>
    <th width=100></th>
    <th width=100></th>
    </tr>
    <TR style="display:none">
    <td><input type=checkbox id=checkLine></td>
    <TD>000</TD>
    <TD>000</TD>
    <TD>000</TD>
    </TR>
    </thead>
    <tbody onclick="showinput()" id=tbody1>
    <TR>
    <td><input type=checkbox id=checkLine></td>
    <TD>aaa</TD>
    <TD>bbb</TD>
    <TD>ccc</TD>
    </TR>
    <TR>
    <td><input type=checkbox id=checkLine></td>
    <TD>ddd</TD>
    <TD>eee</TD>
    <TD>fff</TD>
    </TR>
    <TR>
    <td><input type=checkbox id=checkLine></td>
    <TD>ggg</TD>
    <TD>hhh</TD>
    <TD>iii</TD>
    </TR>
    </tbody>
    <tfoot>
    <tr>
    <td colspan=4 align=center>
    <input type="text" name="tablecell" size="20"></td>
    </tr>
    </tfoot>
    </TABLE></body></html>
      

  4.   

    多谢这位朋友帮忙!可以多问一个问题吗?如果把当前编辑框中的值改变后要更新原来所选行对应的列值应如可实现?举例,若第一行第一列值为aa,选中后在编辑框中改为aab,然后按一个按钮,实现把这个值更新的列值中????不胜感激!