-
Notifications
You must be signed in to change notification settings - Fork 1
/
script2.js
171 lines (163 loc) · 6.92 KB
/
script2.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
const firstDropdown = document.querySelector('#first-dropdown');
const secondDropdownContainer = document.querySelector('#second-dropdown-container');
const secondDropdown = document.querySelector('#second-dropdown');
const fields = document.querySelector('#fields');
const calc = document.querySelector('#calc');
const create_option = (value,tContent)=>{
const option = document.createElement('option');
option.value = value;
option.textContent = tContent;
secondDropdown.appendChild(option);
}
const create_marksinput =(value, tContent)=>{
const label = document.createElement('label');
label.for = value;
label.innerHTML = `${tContent}:`;
const input = document.createElement('input');
input.type = 'number';
input.id = value;
input.name = value;
input.min ='0';
input.max = '100';
input.placeholder = `Enter your ${tContent} marks`;
input.setAttribute('required', '');
// input.setAttribute('required');
fields.appendChild(label);
fields.appendChild(input);
}
const updateSecondDropdownOptions = () => {
secondDropdown.innerHTML="";
if (firstDropdown.value === 'foundation') {
create_option('','Select an option');
create_option('stats1','Statistics-1');
create_option('maths1','Mathematics-1');
create_option('ct','Computational Thinking');
create_option('eng1','English-1');
create_option('stats2','Statistics-2');
create_option('maths2','Mathematics-2');
create_option('python','Python');
create_option('eng2','English-2');
}
else if(firstDropdown.value === 'diploma'){
create_option('','Select an option');
create_option('cs2001','Database Management Systems');
create_option('cs2002','Programming, Data Structures and Algorithms using Python');
create_option('cs2003','Modern Application Development I');
create_option('cs2004','Machine Learning Foundations');
create_option('cs2005','Programming Concepts using Java');
create_option('cs2006','Modern Application Development II');
create_option('cs2007','Machine Learning Techniques');
create_option('cs2008','Machine Learning Practice');
create_option('ms2001','Business Data Management');
create_option('ms2001','Business Analytics');
create_option('se2001','System Commands');
create_option('se2002','Tools in Data Science');
}
else if (firstDropdown.value === 'degree') {
create_option('','Select an option');
create_option('cs3001','Software Testing');
create_option('cs3002','Software Engineering');
create_option('cs3003','AI: Search Methods for Problem Solving');
create_option('cs3004','Deep Learning');
create_option('ee4001','Speech Technology');
create_option('gn3001','Strategies for Professional Growth');
create_option('ms3001','Design Thinking for Data-Driven App Development');
create_option('ms4001','Industry 4.0');
create_option('cs3007','Privacy & Security in Online Social Media');
create_option('bt4001','Algorithmic Thinking in Bioinformatics');
create_option('bt4002','Big Data and Biological Networks');
create_option('gn3002','Financial Forensics');
create_option('cs3006','Introduction to Big Data');
create_option('cs4001','Data visualization');
create_option('ms3002','Market Research');
create_option('ma3001','Linear Statistical Models');
}
};
firstDropdown.addEventListener('change', () => {
if (firstDropdown.value === '') {
secondDropdownContainer.classList.add('hidden');
calc.classList.add('hidden');
} else {
updateSecondDropdownOptions();
secondDropdownContainer.classList.remove('hidden');
}
});
secondDropdownContainer.addEventListener('change', () => {
if (secondDropdown.value === '') {
calc.innerHTML='';
calc.classList.add('hidden');
}
else if(secondDropdown.value === 'stats1' || secondDropdown.value === 'maths1' || secondDropdown.value === 'ct' || secondDropdown.value === 'eng1'
|| secondDropdown.value === 'stats2' || secondDropdown.value === 'maths2' || secondDropdown.value === 'eng2' || secondDropdown.value === 'cs2004'
|| secondDropdown.value === 'cs2007'){
fields.innerHTML='';
create_marksinput('ga','Average Graded Assignment');
create_marksinput('qz1','Quiz 1');
create_marksinput('qz2','Quiz 2');
calc.classList.remove('hidden');
}
else if(secondDropdown.value === 'python'){
fields.innerHTML='';
create_marksinput('ga','Average Graded Assignment');
create_marksinput('qz1','Quiz 1');
create_marksinput('pe1','OPPE 1');
create_marksinput('pe2','OPPE 2');
calc.classList.remove('hidden');
}
else if(secondDropdown.value === 'cs2002' || secondDropdown.value === 'cs2001'){
fields.innerHTML='';
create_marksinput('ga','Average Graded Assignment');
create_marksinput('qz1','Quiz 1');
create_marksinput('qz2','Quiz 2');
create_marksinput('ope','OPE');
calc.classList.remove('hidden');
}
else if(secondDropdown.value === 'cs2005' || secondDropdown.value === 'cs2008'){
fields.innerHTML='';
create_marksinput('ga','Average Graded Assignment');
create_marksinput('qz1','Quiz 1');
create_marksinput('qz2','Quiz 2');
create_marksinput('pe1','OPPE 1');
create_marksinput('pe2','OPPE 2');
calc.classList.remove('hidden');
}
else if(secondDropdown.value === 'se2001'){
fields.innerHTML='';
create_marksinput('ga1','Average Graded Assignment 1');
create_marksinput('ga2','Score in NPPE1');
create_marksinput('ga3','Score in NPPE2');
create_marksinput('qz1','Quiz 1');
create_marksinput('qz2','Quiz 2');
create_marksinput('pe1','OPPE 1');
create_marksinput('pe2','OPPE 2');
calc.classList.remove('hidden');
}
else if(secondDropdown.value === 'cs2006'){
fields.innerHTML='';
create_marksinput('ga1','Average Graded Assignment');
create_marksinput('ga2','Average Programming Assignment');
create_marksinput('qz1','Quiz 1');
create_marksinput('qz2','Quiz 2');
calc.classList.remove('hidden');
}
else if(secondDropdown.value === 'se2002'){
fields.innerHTML='';
create_marksinput('ga','Average Graded Assignment');
create_marksinput('roe1','Remote Online Exam');
create_marksinput('pe1','OPPE 1');
create_marksinput('pe2','OPPE 2');
calc.classList.remove('hidden');
}
else if(secondDropdown.value === 'cs2003'){
fields.innerHTML='';
create_marksinput('ga','Average Graded Assignment');
create_marksinput('gla','Average Lab Assignment');
create_marksinput('qz1','Quiz 1');
create_marksinput('qz2','Quiz 2');
calc.classList.remove('hidden');
}
else {
fields.innerHTML='';
calc.classList.remove('hidden');
}
});