js的引用jquery-3.3.1.min.js、tableExport.js、base64.js
网上找js很麻烦,这有链接
2.要导出的数据(页面展示样式)
3.代码实例
Titlehtml,body{
width: 99%;
height: 99%;
font-family: "微软雅黑";
font-size: 12px;
}
#tables{
width: 100%;
text-align: center;
border: 1px #000 solid;
border-collapse: collapse;
}
#tables th,#tables td{
border: 1px solid #000000;
}
#tables th{
font-size: 14px;
font-weight: bolder;
}
姓名性别年龄地址
素小暖女23辽宁省大连市素小暖男21大窑沟$(document).ready(function(){
$("#export").click(function(){
$("#tables").tableExport({type:"excel",escape:"false"});
});
});