title: Update image src using JavaScript?
body: <p>I  have one image (<code>img.png</code>), with its content changing after a combo box changes.</p>
  
  <p>The problem is the content of the image doesn't change when I change the combo box on the page.</p>
  
  <p>I tried to use JavaScript like this:</p>
  
  <pre><code>function SwitchPic(pic) {
      pic.src = "img.png";
  }
  </code></pre>
  
  <p>and the <code>img</code> tag is:</p>
  
  <pre><code>&lt;img src='img.png' id='img1' name='img1'&gt;
  </code></pre>
  
  <p>and the combo box tag is:</p>
  
  <pre><code>&lt;select name="users" onchange="show(this.value);SwitchPic(img1);"&gt;
      &lt;option value=""&gt;Select a Number:&lt;/option&gt;
      &lt;option value="a"&gt;a&lt;/option&gt;
      &lt;option value="b"&gt;b&lt;/option&gt;
      &lt;option value="c"&gt;c&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>It worked the first time I change the option, but when I re-change the option, it keeps the image without changing it.</p>
  
  <p>How can I solve this?</p>