Skip to content
js
// 导出
document.getElementById('test_button').addEventListener('click', function () {
    download()
}, false);

function download() {
    console.log('导出')
    var excel = "";
    excel += "<table>";
    var html = document.getElementById("score").innerHTML;
    excel += html;
    excel += "</table>";
    var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:" + excel + "' xmlns='http://www.w3.org/TR/REC-html40'>";
    excelFile = excelFile + "<head><style type=\"text/css\">table td {border: 1px solid #000000;width: 200px;height: 30px text-align: center;}</style></head>" + excel + "</body></html>";
    var base64data = "base64," + window.btoa(unescape(encodeURIComponent(excelFile)));
    window.open('data:application/vnd.ms-excel;' + base64data);
}
// 导出
document.getElementById('test_button').addEventListener('click', function () {
    download()
}, false);

function download() {
    console.log('导出')
    var excel = "";
    excel += "<table>";
    var html = document.getElementById("score").innerHTML;
    excel += html;
    excel += "</table>";
    var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:" + excel + "' xmlns='http://www.w3.org/TR/REC-html40'>";
    excelFile = excelFile + "<head><style type=\"text/css\">table td {border: 1px solid #000000;width: 200px;height: 30px text-align: center;}</style></head>" + excel + "</body></html>";
    var base64data = "base64," + window.btoa(unescape(encodeURIComponent(excelFile)));
    window.open('data:application/vnd.ms-excel;' + base64data);
}