forked from fac-14/Week3TakingAIME
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdom.js
21 lines (20 loc) · 831 Bytes
/
dom.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// event listener for submit button
document
// get the value from the drop-down form
.getElementById("line-select")
// add event listener to submit button
.addEventListener("submit", function(event) {
// prevent refresh
event.preventDefault();
var line = document.getElementById("tube-lines");
var value = line.options[line.selectedIndex].value;
console.log(value);
// get selected line's id
var colorKey = line.options[line.selectedIndex].id;
var color = apiFunctions.logoColorObject[colorKey];
document.getElementById("tflphy-logo").style.fill = color;
document.querySelector(".submit").style.backgroundColor = color;
document.body.style.backgroundColor = apiFunctions.bgColorObject[colorKey];
// calls getLineStatus function
apiFunctions.getLineStatus(value);
});