不能用innerHTML的.The innerHTML property is read-only on the FRAMESET, HTML, HEAD, TABLE, TBODY, TFOOT, THEAD, TITLE, and TR objects.
innerHTML对于Table,tr都是只读的.

解决方案 »

  1.   

    <table id="tb"></table>
    <script>
    newRow = tb.insertRow();
    newCell1 = newRow.insertCell();
    newCell1.innerHTML="<form name=myform action='a.asp' method='post'><input type =text id ='input_d' value=''>"
    newCell2 = newRow.insertCell();
    newCell2.innerHTML="<input type = text id=keyno >";
    </script>
      

  2.   

    我现在想做的是,一个tr中加一个form,就是每一行就有一个form,
    动态加行时,把form也加进去。不能用cell.innerHTML
    <tr bgcolor="#FFFFFF" style="display:none" >
     <form name="dtl" action="" method="post" >

                <td width="8%" height="20">
            <div align="left">
              <input name="cdkind" type="text" id = "cdkind" style="behavior:url(htc/zhq.htc)"  readonly ="true" size="10" maxlength="30">
            </div></td>
          <td width="12%" height="20">
            <div align="left">
              <input name="spect" type="text" id = "spect" style="behavior:url(htc/zhq.htc)" readonly ="true" size="15" maxlength="250">
            </div></td>
          <td width="5%" height="20">
            <div align="left">
              <input name="unitno" type="text" id = "unitno" style="behavior:url(htc/zhq.htc)" readonly ="true" size="5" maxlength="15">
            </div></td>
          <td width="8%" height="20">
            <div align="left">
              <input name="qty" type="text" id = "qty" style="behavior:url(htc/zhq.htc)" size="10" maxlength="15" datatype ="numeric">
            </div></td>
          
    <input type="hidden" name="modifyflag" value ="new">
    <input type="hidden" name="recno">
    <input type="hidden" name="m_recno">
    <input type="hidden" name="cdcode">
      
     </form>
        </tr>
    就是把这个行给复制。
    老大们帮忙呀。
    急急。
      

  3.   


    <table ...>
    <script>
    var mys = "<tr> <form name=myform action='a.asp' method='post'>
    <td><input type =text id ='input_d' value=''></td>
    <td><input type = text id=keyno ></td></tr>"
    document.write(mys)
    </script>
    </table>