This commit is contained in:
2020-04-03 13:22:16 +02:00
parent 42c35ca941
commit 4676d8249a
34 changed files with 482 additions and 56 deletions

View File

@@ -0,0 +1,12 @@
function createError(errorMessage) {
const error = document.createElement("div");
error.setAttribute('class', 'error');
const errorBold = document.createElement("b");
errorBold.innerHTML = 'ERROR:';
error.appendChild(errorBold);
errorBold.after(errorMessage);
return error;
}

View File

@@ -0,0 +1,22 @@
const taskArray = tasks.tasks;
const grid = document.getElementsByClassName("textboxGrid")[0];
for (i=0; i<taskArray.length; i++) {
const linkGridElement = document.createElement("div");
linkGridElement.className = "linkGridElement";
const path = taskArray[i]["path"];
linkGridElement.addEventListener("click", function () {
window.location.href = path;
} )
const h2 = document.createElement("h2");
const link = document.createElement("a");
link.href = taskArray[i]["path"];
link.innerHTML = taskArray[i]["name"];
h2.appendChild(link);
linkGridElement.appendChild(h2);
grid.appendChild(linkGridElement);
}

View File

@@ -0,0 +1 @@
const tasks = {"tasks": [{"name": "Oppgave 1", "path": "./oppgaver/oppgave1/oppgave.html"}, {"name": "Oppgave 2", "path": "./oppgaver/oppgave2/oppgave.html"}, {"name": "Oppgave 3", "path": "./oppgaver/oppgave3/oppgave.html"}]}