-
Notifications
You must be signed in to change notification settings - Fork 0
/
Writer.js
73 lines (59 loc) · 2.12 KB
/
Writer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
var nextTableID = 0;
function println(string)
{
document.getElementById("Output").innerHTML += string + "<BR>\n";
}
function printHeading(string, center, heading)
{
if(heading == undefined)
heading = "h3";
if(center == true)
document.getElementById("Output").innerHTML += "<div style=\"text-align: center;\"><"+heading+">" + string + "</"+heading+"></div>\n";
else document.getElementById("Output").innerHTML += "<"+heading+">" + string + "</"+heading+">\n";
}
function createTable(headings)
{
document.getElementById("Output").innerHTML += "<div class='container'><div class='table' id='TableNo"+nextTableID+"'></div></div>";
let string = "<div class='table-header'>";
for(let i=0; i<headings.length; i++)
{
string += "<div class='header__item'><a id='"+headings[i]+"' class='filter__link' href='#'>" + headings[i] + "</a></div>";
}
document.getElementById("TableNo" + nextTableID).innerHTML += string+ "</div>";
document.getElementById("TableNo" + nextTableID).innerHTML += "<div id='ContentTableNo"+nextTableID+"' class='table-content'></div>";
nextTableID++;
}
function addTableRow(data)
{
let string = "<div class='table-row'>";
for(let i=0; i<data.length; i++)
{
string += "<div class='table-data'>" + data[i] + "</div>";
}
document.getElementById("ContentTableNo" + (nextTableID - 1)).innerHTML += string+ "</div>";
}
/*
function createTable(headings)
{
headings = headings.split(",");
document.getElementById("Output").innerHTML += "<table id='TableNo"+nextTableID+"'></table>";
let string = "<tr>";
for(let i=0; i<headings.length; i++)
{
string += "<th>" + headings[i] + "</th>";
console.log(headings[i]);
}
console.log(string);
document.getElementById("TableNo" + nextTableID).innerHTML += string+ "</tr>";
nextTableID++;
}
function addTableRow(data)
{
data = data.split(",");
let string = "<tr>";
for(let i=0; i<data.length; i++)
{
string += "<td>" + data[i] + "</td>";
}
document.getElementById("TableNo" + (nextTableID - 1)).innerHTML += string+ "</tr>";
}*/