Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a lot of plain ol vanilla #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,80 @@
When I click on the 'go' button
the bottom light should turn green.
*/

document.getElementById('stopButton').addEventListener('mouseover', function() {

console.log(document.getElementById('stopLight').text = 'Entered ' + document.getElementById('stopButton').textContent + ' button');
});
document.getElementById('stopButton').addEventListener('mouseout', function() {
console.log(document.getElementById('stopLight').text = 'Left ' + document.getElementById('stopButton').textContent + ' button');
});
//slow button functions
document.getElementById('slowButton').addEventListener('mouseover', function() {

console.log(document.getElementById('stopLight').text = 'Entered ' + document.getElementById('slowButton').textContent + ' button');
});
document.getElementById('slowButton').addEventListener('mouseout', function() {
console.log(document.getElementById('stopLight').text = 'Left ' + document.getElementById('slowButton').textContent + ' button');
});
//go button functions
document.getElementById('goButton').addEventListener('mouseover', function() {

console.log(document.getElementById('goLight').text = 'Entered ' + document.getElementById('goButton').textContent + ' button');
});
document.getElementById('goButton').addEventListener('mouseout', function() {
console.log(document.getElementById('goLight').text = 'Left ' + document.getElementById('goButton').textContent + ' button');
});
document.getElementById('controls').addEventListener('click', function() {
console.log(event.target.textContent);
});
// toggling if one is off then all others are off
document.getElementById('stopButton').addEventListener('click', function() {
if (document.getElementById('stopLight').style.background === 'red') {
document.getElementById('stopLight').style.background = 'black';
} else {
document.getElementById('stopLight').style.background = 'red';
}
});
document.getElementById('slowButton').addEventListener('click', function() {
if (document.getElementById('slowLight').style.background === 'yellow') {
document.getElementById('slowLight').style.background = 'black';
} else {
document.getElementById('slowLight').style.background = 'yellow';
}
});
document.getElementById('goButton').addEventListener('click', function() {
if (document.getElementById('goLight').style.background === 'green') {
document.getElementById('goLight').style.background = 'black';
} else {
document.getElementById('goLight').style.background = 'green';
}
});
document.getElementById('stopButton').addEventListener('click', function() {
if (document.getElementById('slowLight').style.background === 'yellow') {
document.getElementById('slowLight').style.background = 'black';
} else if (document.getElementById('goLight').style.background === 'green') {
document.getElementById('goLight').style.background = 'black';
}
});
document.getElementById('stopButton').addEventListener('click', function() {
if (document.getElementById('slowLight').style.background === 'yellow') {
document.getElementById('slowLight').style.background = 'black';
} else if (document.getElementById('goLight').style.background === 'green') {
document.getElementById('goLight').style.background = 'black';
}
});
document.getElementById('slowButton').addEventListener('click', function() {
if (document.getElementById('stopLight').style.background === 'red') {
document.getElementById('stopLight').style.background = 'black';
} else if (document.getElementById('goLight').style.background === 'green') {
document.getElementById('goLight').style.background = 'black';
}
});
document.getElementById('goButton').addEventListener('click', function() {
if (document.getElementById('slowLight').style.background === 'yellow') {
document.getElementById('slowLight').style.background = 'black';
} else if (document.getElementById('stopLight').style.background === 'red') {
document.getElementById('stopLight').style.background = 'black';
}
});