-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathferdighet9a.html
More file actions
33 lines (30 loc) · 1.33 KB
/
Copy pathferdighet9a.html
File metadata and controls
33 lines (30 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<p>Ferdighet 9a - Valgsetninger Sammenligne to tall: ==, !=, <, <=, >, >=</p>
<input id="tallA" type="text" min="1" max="1000" step="1" oninput="calculate()" value="6" />
<input id="tallB" type="text" min="1" max="1000" step="1" oninput="calculate()" value="2" />
<div id="resultat"></div>
<div id="høyde">A</div>
<div id="bredde">B</div>
<script>
var resultatDiv = document.getElementById('resultat');
var tallAInput = document.getElementById('tallA');
var tallBInput = document.getElementById('tallB');
/* Oppgave: Lag to div-er med teksten “A” og teksten “B”, og to slidere som lar deg bestemme bredde og høyde på valgt div på samme måte som i forrige oppgave.
Vis til enhver tid arealet til begge div-ene (arealet er bredden ganger høyden) og en tekst som sier hvilken div som er størst.*/
calculate();
function calculate() {
var tallA = parseInt(tallAInput.value);
var tallB = parseInt(tallBInput.value);
var arealet = tallA * tallB;
var omkretsen = tallA * tallA + tallB * tallB;
resultatDiv.innerHTML = '';
}
</script>
</body>
</html>