From 4c0962359d4d7187f7d3972b08dedaa52190651c Mon Sep 17 00:00:00 2001 From: hodasemi Date: Sun, 21 Oct 2018 18:03:11 +0200 Subject: [PATCH] Start creating table --- css/main.css | 4 ++++ index.html | 12 +++++++++++- main.js | 15 +++++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/css/main.css b/css/main.css index 5e4b106..e24d95c 100644 --- a/css/main.css +++ b/css/main.css @@ -24,4 +24,8 @@ .topnav p.active { background-color: #4CAF50; color: white; +} + +.table { + } \ No newline at end of file diff --git a/index.html b/index.html index b0153f7..aed73ed 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,17 @@ - + +
+ + + + + \ No newline at end of file diff --git a/main.js b/main.js index d3a0910..92de276 100644 --- a/main.js +++ b/main.js @@ -1,11 +1,12 @@ // Source: https://blog.mounirmesselmeni.de/2012/11/20/reading-csv-file-with-javascript-and-html5-file-api/ // Source: https://www.js-tutorials.com/javascript-tutorial/reading-csv-file-using-javascript-html5/ -function handleFiles(files) { +function handleFile(path) { // Check for the various File API support. if (window.FileReader) { // FileReader are supported. - getAsText(files[0]); + + getAsText(file); } else { alert('FileReader are not supported in this browser.'); } @@ -13,8 +14,13 @@ function handleFiles(files) { function getAsText(fileToRead) { var reader = new FileReader(); - // Read file into memory as UTF-8 + + // Read file into memory as UTF-8 + + // TODO: fileToRead is the path to the file -> create a file handle + reader.readAsText(fileToRead); + // Handle errors load reader.onload = loadHandler; reader.onerror = errorHandler; @@ -44,7 +50,8 @@ function processData(csv) { } table += ""; - $("#parsed_csv_list").html(table); + + document.getElementById('table_bla').innerHTML = table; } function errorHandler(evt) {