title: javascript functions to show and hide divs
body: <p>Hello I have the following 2 JavaScript functions to open up a div and to close it. </p>
  
  <pre><code>&lt;script&gt;
      function show() {
          if(document.getElementById('benefits').style.display=='none') {
            document.getElementById('benefits').style.display='block';
          }
      }
  &lt;/script&gt;
  
  
  
  &lt;script&gt;
      function close() {
          if(document.getElementById('benefits').style.display=='block') {
            document.getElementById('benefits').style.display='none';
          }
      }  
  &lt;/script&gt;
  </code></pre>
  
  <p>Here is the html:</p>
  
  <pre><code>&lt;div id="opener"&gt;&lt;a href="#1" name="1" onclick=show()&gt;click here&lt;/a&gt;&lt;/div&gt;
  &lt;div id="benefits" style="display:none;"&gt;
     some input in here plus the close button
     &lt;div id="upbutton"&gt;&lt;a onclick=close()&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>For some reason the show function works how it should, but the close button does not do its job. So if there is someone who could help me out I really would appreciate. Thanks a lot.</p>