-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
84 lines (46 loc) · 1.74 KB
/
index.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
document.querySelector("form").addEventListener("submit", myfunction);
function myfunction(event) {
event.preventDefault();
var name = document.querySelector("#name").value;
var batch = document.querySelector("#batch1").value;
var field = document.querySelector("#field1").value;
var unit = document.querySelector("#unit1").value;
var sprint= document.querySelector("#sprint1").value;
var marks = document.querySelector("#marks").value;
console.log(name,batch,field,unit,sprint,marks);
const parent = document.createElement('div');
const td1 = document.createElement('h3');
td1.innerText = name;
const td2 = document.createElement('p');
td2.innerText = batch;
const td3 = document.createElement('p');
td3.innerText = field;
const td4 = document.createElement('p');
td4.innerText = unit;
const td5 = document.createElement('p');
td5.innerText = sprint;
const td6 = document.createElement('p');
td6.innerText = marks;
const td7 = document.createElement('h4');
if ( marks <= 3 ) {
td7.innerText = "Learning";
td7.style.color="red";
}
else if (marks >= 4 && marks <= 7 ) {
td7.innerText = "Achieving";
td7.style.color = "orange";
}
else {
td7.innerText = "Mastery";
td7.style.color = "green";
}
var btn = document.createElement('button');
btn.innerText = "Delete";
btn.style.backgroundColor="red";
btn.style.cursor='pointer';
btn.addEventListener("click",function(event){
event.target.parentNode.remove()
})
parent.append(td1,td2,td3,td4,td5,td6,td7,btn);
document.querySelector("#reports").append(parent);
}