-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
49 lines (40 loc) · 1.65 KB
/
script.js
File metadata and controls
49 lines (40 loc) · 1.65 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
/* .js files add interaction to your website */
/* email */
var displayScript = document.getElementById("scriptReturned");
var scriptBtn = document.getElementById("scriptBtn");
if (scriptBtn) {
scriptBtn.addEventListener("click", generateScript);
}
function generateScript() {
var name = document.getElementById("name").value;
var location = document.getElementById("location").value;
var concern = document.getElementById("concern").value
;
displayScript.innerHTML = "As-salamu alaykum, my name is " + name + " and I am from " + location + ". I am calling to ask you to further support Yemen during its ongoing humanitarian crisis. Helping Yemen is a duty that is necessary for us to take. It is important because " + concern + ". Please support Yemen to ensure it's future generation isn't wasted. Thank you. Best regards, " + name + ".";
}
/* fact */
var factList = [
"Four million people have been forced to flee their homes",
"One million are living in unplanned camps",
"Eight out of ten live below the poverty line",
"20 million people need humanitarian aid",
"Five million people are at risk of famine",
"Two million children are out of school",
"15 million need water and sanitation support",
"More than 100,000 people have been killed",
"Nine million people have had their food assistance halved",
"One child every ten minutes dies of a preventable disease",
];
var fact = document.getElementById("fact");
var factBtn = document.getElementById("factBtn");
var count = 0;
if (factBtn) {
factBtn.addEventListener("click", displayFact);
}
function displayFact() {
fact.innerHTML = factList[count];
count++;
if (count == factList.length) {
count = 0;
}
}