Switch two blocks with a table in turn with the help of Js. How to do?

There are two div blocks. In each of the bottom of the table. I have a script:
function openbox(id) {
display = document.getElementById(id).style.display;
if(display=='none') {
document.getElementById(id).style.display='block';
} else {
document.getElementById(id).style.display='none';

}
}
<div class="switches">
 <a href="#" class="knopka1" onclick="openbox('Block1'); return false">Numerator</a>
 <a href="#" class="knopka1" onclick="openbox('Block2'); return false">Denominator</a>
 </div>


How to make it so that pressing the link with another unit , the previous unit automatic hiding and another ?
June 27th 19 at 15:13
1 answer
June 27th 19 at 15:15
Solution
A small trivial example. You can improve it
What to do now that the first open has always been? And when pressed the second , the first disappeared - Kelsi.Reichert commented on June 27th 19 at 15:18
: Very simple, only need to remove class="hide" block with id="table1" - Fay32 commented on June 27th 19 at 15:21
: Thank you. Very grateful to You - Kelsi.Reichert commented on June 27th 19 at 15:24
: Good luck :) - Fay32 commented on June 27th 19 at 15:27

Find more questions by tags CSSJavaScriptHTML