I tried to create a changing background color effect in the following order: Black, White, Red, Green, Blue.
<body style="background-color:black">
<script type="text/javascript">
function changeColor() {
var currentBg = document.bgColor;
var element = document.getElementById("tests");
if (currentBg == "black") {element.style.backgroundColor = "white";}
else if (currentBg == "white") {element.style.backgroundColor = "red";}
else if (currentBg == "red") {element.style.backgroundColor = "green";}
else if (currentBg == "green") {element.style.backgroundColor = "blue";}
else if (currentBg == "blue") {window.location.href="/testson";}
}
</script>
<div class="test" onclick="changeColor()"></div>
</body>
However, upon clicking somewhere on the page, nothing seems to happen.