解决方案 »

  1.   

    innerHTML或者使用jquery的方法
      

  2.   

    <div id="dd"></div>function click(){
           document.getElementById("dd").innerHTML=" 把你那段table代码加到这里";
    }
      

  3.   

    innerHTML方法添加的只是某个值而已,不能根据客户自己的需求动态添加,我的意思就是不能随意的添加值。
      

  4.   

    var html="<tr>
    <td align="right"><label>材质:</label></td>
    <td align="left">
    <div class="button-holder">
    <input type="radio" id="radio-1-1" name="radio-1-set" class="regular-radio big-radio" checked />
    <label for="radio-1-1">全部</label> 
    <input type="radio" id="radio-1-2"name="radio-1-set" class="regular-radio big-radio" />
    <label for="radio-1-2">钢质</label> 
    <input type="radio" id="radio-1-3" name="radio-1-set" class="regular-radio big-radio" />
    <label for="radio-1-3">不锈钢</label>
    </div>
    </td>
    </tr>";
    $(html).appendTo(table);
      

  5.   

    首先建议你使用某个javascript框架,比自己纯手工写效率高。
    然后就是清楚表述你的需求。下面代码可以操作table,插入新行。
    var tableRef = document.getElementById('myTable').getElementsByTagName('tbody')[0];// Insert a row in the table at the last row
    var newRow   = tableRef.insertRow(tableRef.rows.length);// Insert a cell in the row at index 0
    var newCell  = newRow.insertCell(0);// Append a text node to the cell
    var newText  = document.createTextNode('New row')
    newCell.appendChild(newText);
      

  6.   

    javascript框架是引用相应的js包吗?其实我对javascript框架不是很熟!
      

  7.   


    <html>
    <head>
    <script language=javascript>
    function addRow(){
    var f = document.forms['formTest'];
    var input = document.createElement('input');
    input.setAttribute("type","file");
    input.setAttribute("size","30");
    input.setAttribute("name","test");
    f.appendChild(input);
    var br = document.createElement('br');
    f.appendChild(br);
    }
    </script>
    </head>
    </body>
    <form name=formTest action="FileUploadServlet" method="post" 
    enctype="multipart/form-data"> 
    <input name="up" type="submit" value="上传" /> 
    <button type="button" onclick='addRow();'>加入一行</button><br/>
    <input type="file" size="30" name="test" /> 
    <br /> 
    </form>
    </body> 
    </html>