title: JavaScript Image Hide
body: <p>I am making a game in javascript and I needed help with the following:</p>
  
  <p>I want to make an image = to a variable then I only want to show the image when I want it too.</p>
  
  <p>So I want the image by default hidden but it is always showing whatever I do. I am only a beginner and I have looked at this page and others on the internet to help me: <a href="http://www.roseindia.net/javascript/javascriptexamples/javascript-hide-image.shtml" rel="nofollow">http://www.roseindia.net/javascript/javascriptexamples/javascript-hide-image.shtml</a></p>
  
  <p>This is the code so far:</p>
  
  <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
       &lt;img src="http://wwcdn.weddingwire.com/static/vendor/55001_60000/56375/thumbnails/64x‌​64_SQ_1342622451725-Matangiaerial.jpg"
            id="islandimg"&gt;
       &lt;script type="text/javascript"&gt;
       var playermoney = 10000;
       var islandarray = new array;
       var car = 500; var watch = 100;
       var diamond = 2000;
       function hideImage() { 
            if (document.getElementById) {
                 document.getElementById('islandimg').style.visibility = 'hidden';
            }
       &lt;/script&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>The code has other stuff in it for the game but ignore it.</p>