Skip to content

Instantly share code, notes, and snippets.

@jazzyjackson
Created November 28, 2015 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazzyjackson/f5b280709ea785d8812b to your computer and use it in GitHub Desktop.
Save jazzyjackson/f5b280709ea785d8812b to your computer and use it in GitHub Desktop.
<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