<script language="JavaScript"> function setVisibility(id1,id2) { if(document.getElementById('bt1').value=='Show Box 3'){ document.getElementById('bt1').value = 'Show Box 4'; document.getElementById(id1).style.display = 'inline'; document.getElementById(id2).style.display = 'none'; }else{ document.getElementById('bt1').value = 'Show Box 3'; document.getElementById(id1).style.display = 'none'; document.getElementById(id2).style.display = 'inline'; } } </script>
<input type=button name=type id='bt1' value='Show Box 3' onclick="setVisibility('sub3','sub4');";> <div id="sub3">Message Box 3</div> <br><br> <div id="sub4">Message Box 4</div>