-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
38 lines (34 loc) · 986 Bytes
/
index.html
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
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="stylesheets/style.css">
</head>
<body class="flex-container">
<div class="flex-header" id="header">
</div>
<iframe id="page" class="flex-fill" frameBorder="1"></iframe>
<script>
var pageiframe = document.getElementById("page");
var header = document.getElementById("header");
function init(pages) {
"use strict";
for (let i = 0; i < pages.length; i++) {
let page = pages[i];
var button = document.createElement("button");
header.appendChild(button);
button.onclick = function() {
pageiframe.src = page.href;
}
button.innerText = page.title;
}
pageiframe.src = pages[0].href;
}
var req = new XMLHttpRequest();
req.addEventListener("load", function() {
init(JSON.parse(this.responseText));
});
req.open("GET", "./pages.json");
req.send();
</script>
</body>
</html>