title: Replace image by javascript
body: <p>I want to replace the gif file by javascript. I find the method below. Is there any way i can place the javascript tag before the img tag?</p>
  
  <pre><code>&lt;img class="myImg" src="compman.gif" width="107" height="98"&gt;
  
  &lt;script&gt;
      document.getElementsByClassName("myImg")[0].src = "hackanm.gif";
  &lt;/script&gt;
  </code></pre>