<tr> <td> ??
var tr = document.getElementById("b");
tr.innerHTML = "<tr> <td>" + tr.innerHTML;

解决方案 »

  1.   

    我的意思是在table中添加一个节点,需要添加的这个节点要放在id='b' 的子节点下面
      

  2.   

    阿弥陀佛,凑合看!<!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> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
     </head> <body>
      <table> 
       <tr  id='a'> 
          <td> 
             a      
          </td> 
       </tr> 
       <tr id='b'> 
          <td> 
             b 
          </td> 
       </tr> 
       <tr  id='c'> 
          <td> 
             c 
          </td> 
       </tr> 
    </table>
    <input type="button" id="btnAddRow" value="Add Row" />
    <script type="text/javascript">
    <!--
    function $(sId)
    {
    return document.getElementById(sId);
    }$("btnAddRow").onclick = function() 
    {
    var r = $("b");
    var newRow = r.parentNode.insertRow(r.rowIndex+1);
    var newCell = newRow.insertCell();
    newCell.innerHTML = "new cell";
    };
    //-->
    </script>
     </body>
    </html>
      

  3.   

    function addRow()
    {
    var newTr = table1.insertRow(2);
    var newTd0 = newTr.insertCell();
    newTd0.innerText = "d"; 
    }<table id="table1"> 
       <tr  id='a'> 
          <td> 
             a      
          </td> 
       </tr> 
       <tr id='b'> 
          <td> 
             b 
          </td> 
       </tr> 
       <tr  id='c'> 
          <td> 
             c 
          </td> 
       </tr> 
    </table> 
    <input type="button" name="Submit2" value="添加" onclick="addRow()"> 
      

  4.   


    <html>
    <head>
    <title> test</title>
    <script>
    function add(){
    var old = document.getElementById('b');
    var oTbl = document.getElementById('tbl');
    var oRow = oTbl.insertRow(2);
    var oCell = oRow.insertCell(0);
    oCell.appendChild(document.createTextNode('ss'));}</script>
    </head>
    <body >
    <table border='1'id="tbl"> 
       <tr  id='a'> 
          <td> 
             a      
          </td> 
       </tr> 
       <tr id='b'> 
          <td> 
             b 
          </td> 
       </tr> 
       <tr  id='c'> 
          <td> 
             c 
          </td> 
       </tr> 
    </table> 
    <input type="button" value="Insert" onclick="add()">
    </body>
    </html>