用层当然可以,而且很容易定位,不用层的话要对DOM结构有点了解。试试:<table>
<tr bgcolor="yellow">
<td>
<button onclick="parentNode.parentNode.nextSibling.firstChild.innerHTML='ABC'")>test 1</button> 
<button onclick="parentNode.parentNode.nextSibling.firstChild.innerHTML='123'")>test 2</button> 
</td>
</tr>
<tr bgcolor="blue">
<td>123</td>
</tr>
</table>

解决方案 »

  1.   

    TO emu(ston):
       请教用层应该怎么做呢?谢谢
      

  2.   

    用层就简单多了:
    <table>
    <tr bgcolor="yellow">
    <td>
    <button onclick="output.innerHTML='ABC'")>test 1</button> 
    <button onclick="output.innerHTML='123'")>test 2</button> 
    </td>
    </tr>
    <tr bgcolor="blue">
    <td><div id=output>123</div></td>
    </tr>
    </table>
      

  3.   

    呵呵,不用层一样简单:首先,在下面表格的标签要加上ID
    <table id="myTable" border>然后可以象操作对象一样来操作单元格内容了:<script>
       function cellContent(){
          var objRow = myTable.rows;
          var objCell = objRow[0].cells; //0表示你想改变第几行的内容;
          objCell[0].innerText = "xx"; //把00单元格的内容变为xx;
          objCell[1].innerText = "xxx"; //把01单元格的内容变为xxx;
       
       }</script>在上面表格的按钮onclick中调用该函数,OK啦!!!