-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path018 NotOrtalama.html
73 lines (63 loc) · 2.48 KB
/
018 NotOrtalama.html
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.kirmizi{ background-color: red; color:white;}
.turuncu{ background-color: orange; color:white;}
.kahve{ background-color: brown; color:white;}
.yesil{ background-color: green; color:white;}
.mavi{background-color: blue; color:white;}
#sonuc{font-size: 40px;}
</style>
</head>
<body>
<label for="">Not1:</label>
<input type="text" name="not1" id="not1"> <br>
<label for="">Not2:</label>
<input type="text" name="not2" id="not2"> <br>
<label for="">Not3:</label>
<input type="text" name="not3" id="not3"> <br> <br>
<button onclick="hesapla()">Hesapla</button>
<div id="ortalama"></div>
<div id="sonuc"></div>
<script>
function hesapla(){
let n1, n2, n3, ortalama,durum="";
n1=parseFloat(document.getElementById("not1").value);
n2=parseFloat(document.getElementById("not2").value);
n3=parseFloat(document.getElementById("not3").value);
ortalama=(n1+n2+n3)/3;
document.getElementById("ortalama").innerHTML=ortalama;
if (ortalama>=0 && ortalama<50){
durum="Zayıf";
document.getElementById('sonuc').classList.remove();
document.getElementById('sonuc').classList.add('kirmizi');
}
else if (ortalama>=50 && ortalama<55){
durum="Geçer";
document.getElementById('sonuc').classList.remove();
document.getElementById('sonuc').classList.add('turuncu');
}
else if (ortalama>=55 && ortalama<70){
durum="Orta";
document.getElementById('sonuc').classList.remove();
document.getElementById('sonuc').classList.add('kahve');
}
else if (ortalama>=70 && ortalama<85){
durum="İyi";
document.getElementById('sonuc').classList.remove();
document.getElementById('sonuc').classList.add('yesil');
}
else if (ortalama>=85 && ortalama<=100){
durum="Pekiyi";
document.getElementById('sonuc').classList.remove();
document.getElementById('sonuc').classList.add('mavi');
}
document.getElementById("sonuc").innerHTML=durum;
}
</script>
</body>
</html>