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.btoa(unescape(encodeURIComponent(html))); var uri = 'data:application/vnd.ms-excel;base64,' + html; window.location.href = uri; }
欢迎转载,转载请注明:转载自[ http://www.cnblogs.com/zjfree/ ]