Add a file server example (#8)
Added an example of a prim-dns file server setup, with more intricate pages that make use of other files (like including a Javascript script) and dynamic responses (getting a list of agents in the region).
This commit is contained in:
5
file server/example/javascript/index.js
Normal file
5
file server/example/javascript/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
window.addEventListener('load', function() {
|
||||
document.querySelectorAll('.color-button').forEach(btn => btn.addEventListener('click', function() {
|
||||
document.getElementById('color-text').style.color = btn.getAttribute('data-color');
|
||||
}));
|
||||
});
|
||||
26
file server/example/javascript/index.xhtml
Normal file
26
file server/example/javascript/index.xhtml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Javascript example</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootswatch@4.5.2/dist/lumen/bootstrap.min.css" integrity="sha384-GzaBcW6yPIfhF+6VpKMjxbTx6tvR/yRd/yJub90CqoIn2Tz4rRXlSpTFYMKHCifX" crossorigin="anonymous"/>
|
||||
<style>
|
||||
body {
|
||||
margin: 1em;
|
||||
}
|
||||
#color-text {
|
||||
font-size: large;
|
||||
}
|
||||
</style>
|
||||
<script src="index.js"/>
|
||||
</head>
|
||||
<body>
|
||||
<p><a href="..">Home</a></p>
|
||||
<h1>Javascript example:</h1>
|
||||
<div id="color-text">Color me!</div>
|
||||
<button class="color-button btn btn-danger" data-color="red">Red</button>
|
||||
<button class="color-button btn btn-success" data-color="green">Green</button>
|
||||
<button class="color-button btn btn-primary" data-color="blue">Blue</button>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user