little more from the mvc chapter

This commit is contained in:
Geir Okkenhaug Jerstad 2024-08-27 13:11:59 +02:00
parent ed7c48e877
commit cafa3b8957
6 changed files with 87 additions and 27 deletions

32
MVC/MVC_quizz.html Normal file
View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Model View Controller</title>
<style>
</style>
</head>
<body>
<div id="app"></div>
<script>
// Model
let questionIndex = 0;
let points = 0;
// view
updateView();
function updateView(){
let question;
if (questionIndex == 0) question = "Hva er 2 + 2 ?"
document.getElementById('app').innerHTML = /*HTML*/ `
<h1></h1>
Poeng: ${points}<br>
<input type="text">
`;
};
</script>
</body>
</html>