-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
85 lines (74 loc) · 3.06 KB
/
script.js
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
74
75
76
77
78
79
80
81
82
83
84
85
var form = document.getElementById('container')
var res = document.getElementById('res')
function showRes() {
// ----
var name = document.getElementById('name').value;
var rollNum = document.getElementById('rollNum').value;
var engMarks = + document.getElementById('e').value;
var sciMarks = + document.getElementById('s').value;
var urdMarks = + document.getElementById('u').value;
var islMarks = + document.getElementById('i').value
var mathsMarks = + document.getElementById('m').value;
var compMarks = + document.getElementById('c').value;
// ------
if ((name != "") && (rollNum != "") && (engMarks != "" && engMarks <= "100") && (sciMarks != "" && sciMarks <= "100") && (urdMarks != "" && urdMarks <= "100") && (islMarks != "" && islMarks <= "100") && (mathsMarks != "" && mathsMarks <= "100") && (compMarks != "" && compMarks <= "100")) {
document.getElementById('g').style.display = "flex";
res.style.top = '50px';
form.style.display = "none";
var tot = engMarks + sciMarks + urdMarks + islMarks + mathsMarks + compMarks
document.getElementById("total").value = tot + "/600"
document.getElementById("name1").value = name
document.getElementById("rollNum1").value = rollNum
document.getElementById('percentage').value = Math.floor(tot / 600 * 100) + "%";
var percentage = parseFloat(document.getElementById('percentage').value);
if (percentage > 90 || percentage > 100) {
document.getElementById('grade').innerHTML = "A+";
}
else if (percentage > 80) {
document.getElementById('grade').innerHTML = "A";
}
else if (percentage > 70) {
document.getElementById('grade').innerHTML = "B";
}
else if (percentage > 60) {
document.getElementById('grade').innerHTML = "C";
}
else if (percentage > 50) {
document.getElementById('grade').innerHTML = "D";
}
else {
document.getElementById('grade').innerHTML = "F";
}
}
else {
alert("Invalid Input!")
}
}
function hideRes() {
res.style.top = '-105%';
form.style.display = "block";
document.getElementById('g').style.display = "none";
}
const inputElements = document.querySelectorAll('.inp input');
inputElements.forEach(input => {
input.addEventListener('input', () => {
const value = input.value.trim();
const tickIcon = input.nextElementSibling;
if (value) {
tickIcon.style.display = 'inline-block';
} else {
tickIcon.style.display = 'none';
}
});
});
// ---------------------------
function showImage(event) {
document.getElementById('azaan').style.display = 'flex';
var input = event.target;
var reader = new FileReader();
reader.onload = function () {
var image = document.getElementById('user')
image.src = reader.result;
};
reader.readAsDataURL(input.files[0]);
}