title: Show/hide div's with javascript on a button press (and have all div's hidden first)
body: <p>I am new to javascript and I cant seam to hide the div's to start with, I can get the divs to switch between each other any help would be great</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function show(elementId) { 
   document.getElementById("id1").style.display="none";
   document.getElementById("id2").style.display="none";
   document.getElementById("id3").style.display="none";
   document.getElementById(elementId).style.display="block";
  }
  &lt;/script&gt;
  
  
  &lt;button type="button" onclick="show('id1');"&gt;Button 1&lt;/button&gt;
  &lt;button type="button" onclick="show('id2');"&gt;Button 2&lt;/button&gt;
  &lt;button type="button" onclick="show('id3');"&gt;Button 3&lt;/button&gt;
  
  &lt;div id="id1"&gt;text 1&lt;/div&gt;
  &lt;div id="id2"&gt;text 2&lt;/div&gt;
  &lt;div id="id3"&gt;text 3&lt;/div&gt;
  </code></pre>