loops uke 5

This commit is contained in:
Geir Okkenhaug Jerstad 2024-09-04 14:56:03 +02:00
parent 484bde716b
commit 69ce8cd8a6
5 changed files with 128 additions and 2 deletions

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">
<button onclick="updateview()">Print nummer</button>
</div>
<script>
function updateview() {
for (let i = 1; i < 21; i++) {
if (i % 2 == 0){
document.getElementById('app').innerHTML += /*HTML*/ `
<ul>${i}</ul>
`;
}
}
}
</script>
</body>
</html>