startit/oppgaver/uke5/loops-2gangen.html

27 lines
595 B
HTML
Raw Permalink Normal View History

2024-09-04 14:56:03 +02:00
<!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>