如何在表auto onchange中添加新行?

时间:2015-05-07 07:53:55

标签: html

它在第一行表中添加行 我想添加到最后一行

<script>
function addfunction(){
  var table = document.getElementById("mytable");
  var row = table.insertRow(2);
  var cell1 = row.insertCell(0);
  var cell2 = row.insertCell(1);
  var cell3 = row.insertCell(2);
  var cell4 = row.insertCell(3);
  var cell5 = row.insertCell(4);

  cell1.innerHTML = "<input type='number' disabled>";
  cell2.innerHTML = "<input type='number' name='price'>";
  cell3.innerHTML = "<input type='number' name='count'>";
  cell4.innerHTML = "<input type='text' disabled>";
  cell5.innerHTML = "<input type='text' name='barcode' onChange='addfunction()'>";
}
</script>

0 个答案:

没有答案