<div id='colors'>
<div style='height:25px;width:25px;background:red' onclick="a('red')"></div><div style='height:25px;width:25px;background:green' onclick="a('green')"></div><div style='height:25px;width:25px;background:blue' onclick="a('blue')"></div></div>
<input type='button' value='hide' id='show_button' onclick='b()'>
<div id='sqare' style="height:100px;width:100px;background:red"><div>
<style type="text/css">
#colors {
border: solid;
width: 25px
}
</style>
<script>
function a(color) {
document.getElementById('sqare').style.background = color
}
function b() {
with(document.getElementById('colors').style) {
display == 'none' ? display = 'block' : display = 'none'
with(document.getElementById('show_button'))
display == 'none' ? value = 'show' : value = 'hide'
}
}
</script>