Lets say I want a button to double in height when I click it, and then on the next click return to normal. So basically there is a onstate and an offstate and clicking this button just flips between them.
var button = document.getElementById("box1");
button.onclick = function() {
ON: document.getElementById("box1").style.height = "200px";
OFF: document.getElementById("box1").style.height = "100px";
}
How could I rewrite the function so that it keeps track of state? Any help is greatly appreciated!