wu2-prov-js-template/index.html

94 lines
2.9 KiB
HTML
Raw Normal View History

2022-04-04 11:17:33 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScript Prov WU-2</title>
<link rel="stylesheet" href="css/style.css">
2024-03-06 12:11:57 +00:00
<link rel="shortcut icon" type="image/png" href="img/favicon.png">
2022-04-04 11:17:33 +00:00
<script src="js/script.js"></script>
</head>
<body>
<header>
<img src="img/js-logo.svg" alt="js logo">
2024-03-06 12:11:57 +00:00
<h1 id="h1-1">Prov i JavaScript</h1>
2022-04-04 11:17:33 +00:00
<nav>
<a href="#" id="menuBtn">Mennny</a>
<ul>
<li><a href="#">Hem</a></li>
<li>Sida 1</li>
<li>Sida 2</li>
<li>Sida 3</li>
<li>Sida 4</li>
<li>Sida 5</li>
<li>Sida 6</li>
<li>Om</li>
</ul>
</nav>
</header>
<main>
<section>
<h2>Detta om detta</h2>
<h3>Ta bort</h3>
<p> Lorem ipsum dolor sit amet, mea denique iudicabit ne. Quo ipsum errem torquatos te,
nominavi accusata erroribus sit in. Idque facilisis no eam</p>
<p>sea labore fuisset accusamus in.Quo an latine deserunt recteque.</p>
<p>Pro at ponderum consetetur reformidans. Ut nam iudico decore scripta,
per sint delicata te, ne sit modo etiam.</p>
<p> Quo ipsum errem torquatos te, nominavi accusata erroribus sit in. Idque facilisis no eam,
sea labore fuisset accusamus in.</p>
</section>
<section>
<h2>Mer om detta</h2>
<img src="img/henrik.png" width="150" alt="Bild på Henrik Bygren">
<p>Gå till <a href="http://dn.se">DN</a> och titta.</p>
</section>
2024-03-06 12:11:57 +00:00
<section id="klass">
2022-04-04 11:17:33 +00:00
<h2>Klassen</h2>
</section>
<section id="calc">
<fieldset>
2022-05-16 11:14:30 +00:00
<legend>Klassisk räknare</legend>
<button id="dec">-</button><output>0</output><button id="inc">+</button>
2022-04-04 11:17:33 +00:00
</fieldset>
</section>
</main>
<footer>
<section>Uppgift att lösa!</section>
</footer>
</body>
2024-03-06 12:11:57 +00:00
<script>
function renderNames(names){
let section = document.getElementById('klass');
const ul = document.createElement('ul');
const fragment = document.createDocumentFragment();
names.forEach(student => {
const li = document.createElement('li');
li.innerText = student.name;
fragment.appendChild(li);
});
ul.appendChild(fragment);
section.appendChild(ul)
}
async function getNames(){
const response = await fetch('./api/getNames.js');
const names = await response.json();
renderNames(names);
for(let i = 0; i <names.length; i++){
console.log("namn:" + names[i].name)
}
}
getNames();
</script>
2022-04-04 11:17:33 +00:00
</html>