function tableToExcel(id) { var tb = document.getElementById(id); var html = '<html><head><meta charset="UTF-8"></head><body><table>' + tb.innerHTML + '</table></body></html>'; html = window.…
先上代码 <script type="text/javascript" language="javascript"> var idTmr; function getExplorer() { var explorer = window.navigator.userAgent; //ie if (explorer.indexOf("MSIE") >= 0) { return 'ie'; } …
今天在做项目的时候,遇到了前端下载Excel的功能,结果原先的代码,如下: function generate_excel(tableid) { var table = document.getElementById(tableid); var html = table.outerHTML; window.open('data:application/vnd.ms-excel;base64,' + base64_encode(html)); } 此种…