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

View file

@ -1,11 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="app"></div>
<script src="script.js"></script>
</body>
</html>

View file

@ -0,0 +1,21 @@
// Model Variabler
let sentence = ""
let words = ["Green", "Red", "Cat", "Man", "Started", "Jumped", "Pool", "Wall"];
// View
// HTML, onclick CSS
updateView();
function updateView() {
document.getElementById('app').innerHTML = 'Dette er ____';
document.getElementById('app').innerHTML = /*HTML*/ `
<button>${words[0]}</button><button>${words[1]}</button>
<button>${words[2]}</button><button>${words[3]}</button>
<button>${words[4]}</button><button>${words[5]}</button>
<button>${words[6]}</button><button>${words[7]}</button>
`;
};
// Controller endrer modellen
function insertWords() {
}

View file