var btn = document.getElementById('btn');
var isShow = true;
btn.onclick = function() {
var box = document.getElementById('box');
if (isShow) {
box.className = 'hidden';
this.value = 'show';
isShow = false;
} else {
box.className = 'show';
this.value = 'hide';
isShow = true;
}
}
<input type="button" id="btn" value="hide"/>
<br>
<div id="box"></div>
#box {
background-color:red;
width: 200px;
height: 200px;
}
.hidden {
display: none;
}
.show {
display: block;
}