-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