From a6738c2b708ebe5abd4ccea4344d789718fe06e1 Mon Sep 17 00:00:00 2001 From: eloisebarrow Date: Sun, 5 Jun 2016 19:45:48 -0400 Subject: [PATCH] HW submission #3 from Eloise Barrow --- index.html | 3 ++- js/index.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 js/index.js diff --git a/index.html b/index.html index 0180c07..d37abac 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,7 @@

Go

- + + diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..4c9dfbb --- /dev/null +++ b/js/index.js @@ -0,0 +1,28 @@ +$(document).ready(function(){ + +$('#stopButton').click(illuminateRed); +$('#slowButton').click(illuminateYellow); +$('#goButton').click(illuminateGreen); + +function illuminateRed() { + clearLights(); + $('#stopLight').css('backgroundColor', 'red'); +} + +function illuminateYellow() { + clearLights(); + $('#slowLight').css('backgroundColor', 'yellow'); +} + +function illuminateGreen() { + clearLights(); + $('#goLight').css('backgroundColor', 'green'); +} + +function clearLights() { + $('#stopLight').css('backgroundColor', 'black'); + $('#slowLight').css('backgroundColor', 'black'); + $('#goLight').css('backgroundColor', 'black'); +} + +}); \ No newline at end of file