1. 前端显示

2. 前段代码
<input type="checkbox" checked="checked" name="baseTable" value="product"/><span>product</span>
<input type="checkbox" checked="checked" name="baseTable" value="cmmprocess"/> <span>cmmprocess </span>
<input type="checkbox" checked="checked" name="baseTable" value="productparam"/> <span>productparam </span>
<div class="col-sm-4"><input type="checkbox" checked="checked" name="baseTable" value="app_user"/> <span>app_user </span>
<input type="checkbox" checked="checked" name="baseTable" value="equipinputaccount"/> <span>equipinputaccount </span>
<button type="button" class="btn btn-primary" onclick="Export()" style="margin-left:10px"> <i class="fa fa-download" aria-hidden="true"></i> 数据导出
</button>
3、js代码
function Export(){ //基础表导出
var obj = document.getElementsByName("baseTable");
var baseTable=[];
for(var i in obj){
if(obj[i].checked){
baseTable.push(obj[i].value);
}
}
alert(baseTable);
}
本文介绍了一种前端实现表格导出的方法,通过HTML和JavaScript完成数据的选择与导出操作。示例中使用了复选框来让用户选择需要导出的基础表,并通过按钮触发导出功能。

2万+

被折叠的 条评论
为什么被折叠?



