<div>0</div>
<button>Click</button>
<script>
var dest = document.querySelector('div'),
trig = 1;
function setOne() {
dest.innerText = "1";
}
function setZero() {
dest.innerText = "0";
}
document.querySelector('button').addEventListener('click', function() {
var act = trig > 0? setOne():setZero();
trig = -trig;
});
</script>