Prepare test

This commit is contained in:
2020-04-03 08:11:05 +02:00
parent 06f057d19d
commit 42c35ca941
17 changed files with 897 additions and 0 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"}]}