missed
This commit is contained in:
BIN
2018-19-1-04/Megoldás/gknb_intm049_2018-19-1_04.odt
Normal file
BIN
2018-19-1-04/Megoldás/gknb_intm049_2018-19-1_04.odt
Normal file
Binary file not shown.
41
2018-19-1-04/Megoldás/index.html
Normal file
41
2018-19-1-04/Megoldás/index.html
Normal file
@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vizsgaeredmények rögzítése</title>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Vizsgaeredmények rögzítése</h1>
|
||||
<table id="MainTable">
|
||||
<tr>
|
||||
<th>Ssz</th>
|
||||
<th>Név</th>
|
||||
<th>Neptun</th>
|
||||
<th>Eredmény</th>
|
||||
</tr>
|
||||
<tr id="sample">
|
||||
<th>1.</th>
|
||||
<td><input type="text" name="" id=""></td>
|
||||
<td><input type="text" name="" id="" maxlength="6"></td>
|
||||
<td>
|
||||
<select name="" id="" class="marks" onchange="updateaverage()">
|
||||
<option value="0">Nem jelent meg</option>
|
||||
<option value="1">Elégtelen (1)</option>
|
||||
<option value="2">Elégséges (2)</option>
|
||||
<option value="3">Közepes (3)</option>
|
||||
<option value="4">Jó (4)</option>
|
||||
<option value="5">Jeles (5)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="display:flex">
|
||||
<button style="float: left; margin-right: 5px;" onclick="newliner()">+</button>
|
||||
<p id="average" style="float: left; margin: 0;">Az átlag: </p>
|
||||
</div>
|
||||
|
||||
<script src="./script.js"></script>
|
||||
</body>
|
||||
</html>
|
29
2018-19-1-04/Megoldás/script.js
Normal file
29
2018-19-1-04/Megoldás/script.js
Normal file
@ -0,0 +1,29 @@
|
||||
var counter = 1;
|
||||
|
||||
function newliner(){
|
||||
counter += 1;
|
||||
var child = document.getElementById("sample");
|
||||
child = child.cloneNode(true);
|
||||
child.id = "";
|
||||
child.children[0].textContent = counter;
|
||||
child.children[1].children[0].value = "";
|
||||
child.children[2].children[0].value = "";
|
||||
child.children[3].children[0].value = 0;
|
||||
document.getElementById("MainTable").appendChild(child);
|
||||
updateaverage();
|
||||
}
|
||||
|
||||
function updateaverage(){
|
||||
var marks = Array.from(document.getElementsByClassName("marks"));
|
||||
var avg = 0;
|
||||
for(var i = 0; i < marks.length; i++){
|
||||
if(Number(marks[i].value) == 0){
|
||||
avg += 1
|
||||
}else{
|
||||
avg += Number(marks[i].value);
|
||||
}
|
||||
}
|
||||
avg = Math.floor((avg * 100) / marks.length);
|
||||
avg = avg / 100;
|
||||
document.getElementById("average").textContent = `Az átlag: ${avg}`;
|
||||
}
|
17
2018-19-1-04/Megoldás/style.css
Normal file
17
2018-19-1-04/Megoldás/style.css
Normal file
@ -0,0 +1,17 @@
|
||||
table{
|
||||
border-collapse: collapse;
|
||||
}
|
||||
td, th{
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
}
|
||||
h1{
|
||||
font-size: 16pt;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
th{
|
||||
text-align: center;
|
||||
}
|
||||
tr:hover{
|
||||
background-color: lightgrey;
|
||||
}
|
Reference in New Issue
Block a user