<div id='first'>first</div>
<div id='second' style="display: none">second</div>
<a id="back">back</a>
<a id="forward">forward</a>
<script>
Array.apply(null, document.querySelectorAll('#back, #forward')).map(function (element) {
element.addEventListener("click", navigation);
});
function navigation() {
var style = {
back: ["block", "none"],
forward: ["none", "block"]
}[this.id];
first.style.display = style[0];
second.style.display = style[1];
}
</script>
:)