2024-08-30 10:34:25 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2024-09-02 09:06:12 +02:00
|
|
|
|
2024-08-30 10:34:25 +02:00
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>MVC Skjemaer</title>
|
|
|
|
</head>
|
2024-09-02 09:06:12 +02:00
|
|
|
|
2024-08-30 10:34:25 +02:00
|
|
|
<body>
|
|
|
|
<div id="app">
|
2024-09-02 09:06:12 +02:00
|
|
|
|
2024-08-30 10:34:25 +02:00
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
// model
|
2024-09-02 09:06:12 +02:00
|
|
|
let message = 'Alt gikk bra';
|
|
|
|
|
2024-08-30 10:34:25 +02:00
|
|
|
|
|
|
|
// view
|
|
|
|
updateView()
|
2024-09-02 09:06:12 +02:00
|
|
|
function updateView() {
|
|
|
|
messageBoxHtml = /*HTML*/ `<p>${message}</p>`;
|
2024-08-30 10:34:25 +02:00
|
|
|
|
2024-09-02 09:06:12 +02:00
|
|
|
document.getElementById('app').innerHTML = /*HTML*/ `
|
2024-08-30 10:34:25 +02:00
|
|
|
<h1>Min app</h1>
|
2024-09-02 09:06:12 +02:00
|
|
|
${createMessageBoxHtml()}
|
2024-08-30 10:34:25 +02:00
|
|
|
<button>Vis sukksess</button>
|
|
|
|
<button>Vis advarsel</button>
|
2024-09-02 09:06:12 +02:00
|
|
|
<button>Vis feil</button>
|
|
|
|
<button>Vis info</button>
|
2024-08-30 10:34:25 +02:00
|
|
|
`;
|
2024-09-02 09:06:12 +02:00
|
|
|
function createMessageBoxHtml() {
|
|
|
|
if (message == null) return '';
|
|
|
|
return messageBoxHtml;
|
|
|
|
}
|
2024-08-30 10:34:25 +02:00
|
|
|
}
|
|
|
|
// controller
|
|
|
|
</script>
|
|
|
|
</body>
|
2024-09-02 09:06:12 +02:00
|
|
|
|
2024-08-30 10:34:25 +02:00
|
|
|
</html>
|