动态生成表格
来源:互联网 发布:js函数返回true false 编辑:程序博客网 时间:2024/06/05 00:23
<tr id="option1">
<td><input type="text" class="form-control" placeholder="商品编号" style="margin-right:30px"></td>
<td><input type="text" class="form-control" placeholder="商品名称" style="margin-right:30px"></td>
<td><input type="text" class="form-control" placeholder="商品数量" style="margin-right:30px"></td>
<td><input type="text" class="form-control" placeholder="商品单价" style="margin-right:30px"></td>
<td><input type="button" value="添加" onclick="add()"></td>
<!-- <td><input type="button" value="删除" onclick="dele()"></td> -->
</tr>
</table>
<script type="text/javascript">
var rowCount=1;
function add(){
rowCount++;
var newRow='<tr id="option'+rowCount+'">'+
'<td><input type="text" class="form-control" placeholder="商品编号" style="margin-right:30px"></td>'+
'<td><input type="text" class="form-control" placeholder="商品名称" style="margin-right:30px"></td>'+
'<td><input type="text" class="form-control" placeholder="商品数量" style="margin-right:30px"></td>'+
'<td><input type="text" class="form-control" placeholder="商品单价" style="margin-right:30px"></td>'+
'<td><input type="button" value="添加" onclick="add()"></td>'+
'<td><input type="button" value="删除" onclick="dele(rowCount)"></td>';
$('#optionContainer').append(newRow);
}
function dele(rowIndex){
$("#option"+rowIndex).remove();
rowCount--;
}
</script>
- 动态生成表格
- javascript动态生成表格
- JS动态生成表格
- javascript 动态生成表格
- JS 动态生成表格
- js动态生成表格
- Js动态生成表格
- Literal生成动态表格
- 动态生成表格
- 动态生成表格示例
- 动态生成表格
- 动态生成表格
- js 动态生成表格
- 动态生成表格
- 动态生成表格
- 动态生成表格
- js动态生成表格
- Jquery 动态生成表格
- ARM MMU工作原理剖析
- SSH-service错误
- Linux下测试使用scp
- Java的几种对象
- 盲信号的背景
- 动态生成表格
- java中二维数组的操作
- c语言文件操作函数应用(1) ——学习整理
- angularjs ui-grid 导出表格数据csvExport
- Java POI 导出EXCEL经典实现以及 Java导出Excel弹出下载框
- 那两年炼就的Android内功修养
- 一位资深程序员大牛给予Java初学者的学习路线建议
- 踩坑,踩的坑真好,PreView仅供参考
- H5实现摇一摇技术总结