title: Resize images to fit image control in asp.net javascript
body: <p>I change an image in the header based on which menu item is selected. The problem is that the image stretches in the image control. I want it to automatically zoom without distorting the image. Is this possible.</p>
  
  <p>Note: The images reside in an images folder and are not all the same size.</p>
  
  <p>Javascript</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      function ChangeProjectImage(imgpath) {
          var img1 = document.getElementById("Image2")
          img1.src = imgpath;
      }
  
  &lt;/script&gt;
  </code></pre>