Switch between tables hide/show

Switch between tables hide/show

I am currently doing the below and it works...although I have two buttons....
I want to have ONE button that changes between tables and when it does changes the name on the button
Is this possible?  How do I combine into one button and then changes the text of the button?
Thanks hope you can help....

<script type="text/javascript">
$(function()
{
$("#TableButton").click(function(){
$('.listRow1').show(3000);
$('.listRow2').show(3000);
$('.iconRow').hide();
});
$("#IconButton").click(function()
  {
$('.iconRow').show(2000);
$('.listRow1').hide();
$('.listRow2').hide();
});
});
</script>

<button id="TableButton">Table View</button>
<button id="IconButton">Icon View</button>