oppgave uke 4

This commit is contained in:
Geir Okkenhaug Jerstad 2024-08-30 13:46:41 +02:00
parent f072b9146e
commit 996f8b9d05

View file

@ -5,7 +5,7 @@ let word1 = '__ ';
let word2 = '__ '; let word2 = '__ ';
let word3 = '__ '; let word3 = '__ ';
let word4 = '__ '; let word4 = '__ ';
let sentence = "Once there was " + word1 + " " + word2 +" that " + word3 + " in the " + word4 + " - and great things happened. The End"; let sentence = "Once there was " + word1 + " " + word2 + " that " + word3 + " in the " + word4 + " - and great things happened. The End";
// View // View
// HTML, onclick CSS // HTML, onclick CSS
updateView(); updateView();
@ -28,25 +28,26 @@ function updateView() {
// Controller endrer modellen // Controller endrer modellen
function insertWords1(word) { function insertWords1(word) {
word1 = word; word1 = word;
sentence = "Once there was " + word1 + " " + word2 +" that " + word3 + " in the " + word4 + " - and great things happened. The End"; sentence = "Once there was " + word1 + " " + word2 + " that " + word3 + " in the " + word4 + " - and great things happened. The End";
document.getElementById('sentence').innerHTML = sentence; document.getElementById('sentence').innerHTML = sentence;
updateView(); updateView();
} }
function insertWords2(word) { function insertWords2(word) {
word2 = word; word2 = word;
sentence = "Once there was " + word1 + " " + word2 +" that " + word3 + " in the " + word4 + " - and great things happened. The End"; sentence = "Once there was " + word1 + " " + word2 + " that " + word3 + " in the " + word4 + " - and great things happened. The End";
document.getElementById('sentence').innerHTML = sentence; document.getElementById('sentence').innerHTML = sentence;
updateView();
} }
function insertWords3(word) { function insertWords3(word) {
word3 = word; word3 = word;
sentence = "Once there was " + word1 + " " + word2 +" that " + word3 + " in the " + word4 + " - and great things happened. The End"; sentence = "Once there was " + word1 + " " + word2 + " that " + word3 + " in the " + word4 + " - and great things happened. The End";
document.getElementById('sentence').innerHTML = sentence; document.getElementById('sentence').innerHTML = sentence;
updateView();
} function insertWords4(word) { }
word4 = word; function insertWords4(word) {
sentence = "Once there was " + word1 + " " + word2 +" that " + word3 + " in the " + word4 + " - and great things happened. The End"; word4 = word;
document.getElementById('sentence').innerHTML = sentence; sentence = "Once there was " + word1 + " " + word2 + " that " + word3 + " in the " + word4 + " - and great things happened. The End";
document.getElementById('sentence').innerHTML = sentence;
updateView();
} }