點擊按鈕我需要我的表一次添加多個行,包括多列.....代碼是通過使用Java腳本....我使用插入單元格()方法插入一個空的單元格在我的表.....當我點擊按鈕,並添加一行,一次只有一個單行添加.....我想多行(例如... 7行)具有相同數量的列,通過單擊該按鈕僅顯示一次....要生成多行
我怎樣才能使表的最後一行(我的意思是如果我一次在表中添加7行) ...我需要第7行邊界底部是堅實的,並重復到每個第7邊界底部.....在上面的程序......還可以得到一些使用rowspan和colspan的想法以上程序
function display(){
\t var tableRef = document.getElementById('myTable1').getElementsByTagName('tbody')[0];
\t var rowsAdd = tableRef.insertRow();
\t var newCell = rowsAdd.insertCell();
\t newCell.innerHTML="<tr><td><input form ='forma' class= 'form-control input-sm' type='text' id = 'time' name= 'time' required> </td></tr><tr></tr>";
\t newCell.style.width ='70px';
\t
\t newCell = rowsAdd.insertCell();
\t newCell.innerHTML="<tr><td><input form ='forma' class= 'form-control input-sm' id = 'oraltype' name= 'oraltype' required></td></tr><tr></tr>";
\t newCell.style.width ='55px';
\t
\t newCell= rowsAdd.insertCell();
\t newCell.innerHTML="<tr><td><input form ='forma' class= 'form-control input-sm' type='text' id = 'oralamt' name= 'oralamt' required></td></tr>";
\t newCell.style.width ='75px';
\t
\t
\t newCell = rowsAdd.insertCell();
\t newCell.innerHTML="<tr><td><input form ='forma' class= 'form-control input-sm' id = 'oralcommence' name= 'oralcommence' required></td></tr>";
\t newCell.style.width ='65px';
newCell = rowsAdd.insertCell();
\t newCell.innerHTML="<tr><td><i class='fa fa-trash-o' style='font-size:20px' onclick='deleteRow(this)'></i></td></tr><tr></tr>";
\t newCell.style.width ='50px';
\t }
#myTable1 {
border-collapse: collapse;
width: 100%;
}
#myTable1 th {
background-color: #009999;
color: black;
width : 190px;
}
.table-fixed{
}
#myTable1 .tbody1{
height:150px;
overflow-y:auto;
}
#myTable1 thead,.tbody1{
display:block;
}
<table class="table table-striped table-bordered table-fixed table-hover table-condensed" style="width: 1200px; align:left;" id="myTable1">
<thead>
<tr>
<th rowspan = '2' style="width:130px;">Date Comm.</th>
<th rowspan='2' style="width:130px;">Drug</th>
<th rowspan='2' style="width:130px;">Dosage</th>
<th rowspan='2'style="width:130px;">Route Of Admin</th>
</tr>
</thead>
<tbody class="tbody1">
</tbody>
<tr id="hiderow">
\t \t <td><button onclick="display()"></button></td>
\t \t </tr>
\t \t
</table>
我該如何製作表格的最後一行(我的意思是如果我一次在表格中添加7行)......我需要第7行邊框底部變得牢固,並且重複到每個第7個邊框底部... ..在上面的程序中......還可以在上述程序中使用rowspan和colspan的一些想法 – usr