title: Javascript Images with If/else statement
body: <p>I am thinking there is something wrong with my if/else statement that is making this code not work. I have tried changing the id and also using document.canvas.src instead of getElementById but it wont work either way for me.</p>
  
  <p>UPDATE: Below is the code I used to get it to function properly:</p>
  
  <pre><code>&lt;HTML&gt;
  &lt;HEAD&gt;
  &lt;script type = "text/javascript"&gt;
  
  
  function displayImage(whichImage) 
  {
      if(whichImage != "noImage")
      {
          document.canvas.src= whichImage;
      }
      else{
          document.canvas.src= "blank.jpg";
      }
  }
  
  
  &lt;/script&gt;
  &lt;/HEAD&gt;
  
  &lt;BODY&gt;
  &lt;form name="imageForm"&gt;
  &lt;table border=3&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;select name="imageSelector" onChange="displayImage(this.value)"&gt;
      &lt;option value="noImage"&gt;Select an Animal
      &lt;option value="dog.jpg"&gt;Dog
      &lt;option value="cat.jpg"&gt;Cat
      &lt;option value="parrot.jpg"&gt;Parrot
      &lt;option value="fish.jpg"&gt;Fish
      &lt;option value="alligator.jpg"&gt;Alligator
      &lt;option value="mouse.jpg"&gt; Mouse
      &lt;option value="fox.jpg"&gt;Fox
  &lt;/select&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;img src="blank.jpg" name="canvas" id="animal"&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>