litt oppdatering av landing-siden

This commit is contained in:
Geir Okkenhaug Jerstad 2024-08-23 10:18:23 +02:00
parent 9929d0349f
commit 9f2b5a393b
4 changed files with 21 additions and 7 deletions

View file

@ -1,10 +1,12 @@
<!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>
Poeng <span id="points"></span><br>
<button onclick="addPoints()">Klikk her</button>
@ -13,19 +15,22 @@
<script>
let points = 0;
let upgrades = 1;
function addPoints(){
function addPoints() {
points += upgrades;
document.getElementById('points').innerHTML = points;
};
function upgrade(){
upgrades++;
points -= 10;
document.getElementById('points').innerHTML = points;
function upgrade() {
if (points >= 10) {
upgrades++;
points -= 10;
document.getElementById('points').innerHTML = points;
}
}
function reset(){
function reset() {
points = 0;
upgrades = 1;
}
</script>
</body>
</html>