diff --git a/index.html b/index.html index 0180c07..45ce790 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,7 @@

Go

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