-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
79 lines (73 loc) · 2.51 KB
/
script.js
File metadata and controls
79 lines (73 loc) · 2.51 KB
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
function ageGetter(age_input) {
//event.preventDefault();
//var age_input = document.getElementById("user_age_input").value;
if (age_input <= 0) {
alert("Error, please input an appropriate age.");
}
else if (age_input <= 20) {
alert("You are not at risk! Be safe!");
}
else if (age_input <=55){
alert("You are not at immediate risk, but stay safe!");
}
else if (age_input > 55){
alert("Watch out! You are in the risky category!");
}
else {
null;
}
}
function showAge() {
age_shower.innerText = "Your Age: " + document.getElementById("user_age_input").value;
}
function onSubmit(){
event.preventDefault();
var age_input = document.getElementById("user_age_input").value;
//find out how many checkboxes yuu have selected
var AllYourSymptons = "";
var numberOfSymptoms = 0;
const cbs = document.querySelectorAll('input[name="sympton"]');
cbs.forEach((cb) => {
if(cb.checked){
AllYourSymptons = AllYourSymptons + "\n" + cb.value;
numberOfSymptoms++;
}
}); //end of foreach loop
//now show all the AllYourSymptons
if (numberOfSymptoms > 0) {
alert("Careful! You have the following symptoms: " + AllYourSymptons + "\nSo please stay at home and quarantine yourself! \nAlso, please go to your nearest COVID-19 testing center safely and with a mask. Always remain 6-feet apart!");
}
else {
alert("Great, you don't have any symptoms. However, be careful and always remember to wash your hands, stay 6-feet apart, and wear a mask when going outside.");
ageGetter(age_input);
}
}
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
function filterFunction() {
var input, filter, ul, li, a, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
div = document.getElementById("myDropdown");
a = div.getElementsByTagName("a");
for (i = 0; i < a.length; i++) {
txtValue = a[i].textContent || a[i].innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
a[i].style.display = "";
} else {
a[i].style.display = "none";
}
}
}
const revealInfo = document.querySelector('#Corona-section');
window.onscroll = function(){
var infoscroll = window.scrollY;
if (infoscroll >= 250){
revealInfo.classList.add('active')
}else{
revealInfo.classList.remove('active');
}
}