-1
我有一个脚本,它可以从html表格数据生成一个csv文件。下面的脚本在链接类导出被点击时强制下载。我想这会在页面加载时自动发生。这是可能的吗?我试图将其从点击功能转换为打开
$(".export").on('click', function (event) {
// CSV
var args = [$('#output>table'), 'heartbeat.csv'];
exportTableToCSV.apply(this, args);
// If CSV, don't do event.preventDefault() or return false
// We actually need this to be a typical hyperlink
});
可能的复制[如何在页面加载时调用JavaScript函数?](http://stackoverflow.com/questions/3842614/how-do-i-call-a-javascript-function-on-page-load) – DibsyJr