<h1 id="turnBlack">Off</h1> | |
<h1 id="turnWhite">On</h1> | |
<script> | |
var turnBlackButton = document.getElementById("turnBlack") | |
var turnWhiteButton = document.getElementById("turnWhite") | |
function turnBlack() { | |
document.body.style.background = 'black' | |
turnBlackButton.style.color = 'white' | |
turnWhiteButton.style.color = 'white' | |
} | |
function turnWhite() { | |
document.body.style.background = 'white' | |
turnBlackButton.style.color = 'black' | |
turnWhiteButton.style.color = 'black' | |
} | |
turnBlackButton.onclick = turnBlack | |
turnWhiteButton.onclick = turnWhite | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment