-
Notifications
You must be signed in to change notification settings - Fork 0
/
change.js
84 lines (76 loc) · 3.71 KB
/
change.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
let yes_button=document.querySelector('#age_yes');
let no_button=document.querySelector("#age_no");
let image=document.getElementById('images');
let content=document.querySelector('#content');
let heading=document.querySelector('h2');
let btn=document.getElementById('btn');
yes_button.addEventListener('click',() =>{
if(heading.innerText=='Are you 18-75 years old?'){
heading.innerText='Had a tattoo in the last 4 months?';
image.innerHTML='<img class="images" src="heart.jpg">';
}
else if(heading.innerText=='Had a tattoo in the last 4 months?'){
heading.innerText='Did you get you tattoo in a licensed or regulated premises?';
image.innerHTML='<img class="images" src="heart.jpg">';
}
else if(heading.innerText=='Did you get you tattoo in a licensed or regulated premises?'){
heading.innerText='Are you pregnant or recently given birth?';
image.innerHTML='<img class="images" src="pregnant.jpg">';
}
else if(heading.innerHTML=='Are you pregnant or recently given birth?')
{
btn.innerHTML='<a href="home.php">Go back to home page</a>';
heading.innerHTML='Sorry! You are not eligible to Donate Blood.';
image.innerHTML='<img class="images" src="alert2.jpg">';
}
else if(heading.innerHTML=='Do you have a heart condition?')
{
btn.innerHTML='<a href="home.php">Go back to home page</a>';
heading.innerHTML='Sorry! You are not eligible to Donate Blood.';
image.innerHTML='<img class="images" src="alert2.jpg">';
}
else if(heading.innerHTML=='Are you low in iron?')
{
btn.innerHTML='<a href="home.php">Go back to home page</a>';
heading.innerHTML='Sorry! You are not eligible to Donate Blood.';
image.innerHTML='<img class="images" src="alert2.jpg">';
}
else if(heading.innerHTML=='Have you injected recreational drugs in the last 5 years?')
{
btn.innerHTML='<a href="home.php">Go back to home page</a>';
heading.innerHTML='Sorry! You are not eligible to Donate Blood.';
image.innerHTML='<img class="images" src="alert2.jpg">';
}
});
no_button.addEventListener('click',() =>{
if(heading.innerText=='Are you 18-75 years old?'){
btn.innerHTML='<a href="home.php">Go back to home page</a>';
heading.innerText='Sorry! You are not eligible to Donate Blood.';
image.innerHTML='<img class="images" src="alert2.jpg">';
}
else if(heading.innerText=='Had a tattoo in the last 4 months?'){
heading.innerText='Are you pregnant or recently given birth?';
image.innerHTML='<img class="images" src="pregnant.jpg">';
}
else if(heading.innerText=='Are you pregnant or recently given birth?'){
heading.innerText='Do you have a heart condition?';
image.innerHTML='<img class="images" src="heart3.png">';
}
else if(heading.innerText=='Do you have a heart condition?'){
heading.innerText='Are you low in iron?';
image.innerHTML='<img class="images" src="iron.jpg">';
}
else if(heading.innerHTML=='Are you low in iron?')
{
heading.innerHTML='Have you injected recreational drugs in the last 5 years?';
image.innerHTML='<img class="images" src="drugs.jpg">';
}
else if(heading.innerHTML=='Have you injected recreational drugs in the last 5 years?')
{
btn.innerHTML='<a href="donor_form.php">Register as a donor</a>';
heading.innerHTML='Congratulations you should be able to give blood!!';
image.innerHTML='<img class="images" src="check.png">';
}
//console.log(heading.innerText);
});
//console.log(heading.innerText);