:neckbeard: Danny's solution

This commit is contained in:
Danny Fritz 2015-11-03 13:21:32 -07:00
parent 873727666b
commit a3fcfe763f

View File

@ -8,3 +8,30 @@
When I click on the 'go' button When I click on the 'go' button
the bottom light should turn green. the bottom light should turn green.
*/ */
var stopButton = document.querySelector("#stopButton");
var stopLight = document.getElementById('stopLight');
stopButton.addEventListener("click", function(){
var color;
stopLight.style.backgroundColor === "red" ? color = "" : color = "red";
stopLight.style.backgroundColor = color;
});
var slowButton = document.querySelector("#slowButton");
var slowLight = document.getElementById('slowLight');
slowButton.addEventListener("click", function(){
var color;
slowLight.style.backgroundColor === "orange" ? color = "" : color = "orange";
slowLight.style.backgroundColor = color;
});
var goButton = document.querySelector("#goButton");
var goLight = document.getElementById('goLight');
goButton.addEventListener("click", function(){
var color;
goLight.style.backgroundColor === "green" ? color = "" : color = "green";
goLight.style.backgroundColor = color;
});