title: Hide/Show image after 2 seconds
body: <p>So I need to have an image alternatively appear and disappear every 2 seconds, I've been trying using javascript and I've gotten stuck, I feel like it's something so simple but i can't work it out, any help is appreciated.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;body onload="Show()"&gt;
  &lt;div align="center"&gt;
  &lt;img id="image" src="image1.png" height="200" width="200"&gt;
  </code></pre>
  
  <p><strong>JAVASCRIPT</strong></p>
  
  <pre><code>var Cntr=1
  
  function Hide()
  {
      Cntr++;
      document.getElementById("image").style.visibility="hidden";
      if (Cntr==2){
          setTimeout("Hide", 2000);
      }
  }
  
  function Show() 
  {
      Cntr--;
      document.getElementbyId("image").style.visibility="visible";
      if (Cntr==1) {
          setTimeout("Show", 2000);
      }
  
  }
  </code></pre>