title: javascript to zoom images
body: <p>I cant seem to get this to work.  I'm trying to convert a javascript bookmarklet into a javascript onclick function to zoom in on images in the page.</p>
  
  <p>The bookmarklet is as follows...</p>
  
  <pre><code>javascript:(function(){ function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid accumulating integer-rounding error */ image.initialHeight=image.height; image.initialWidth=image.width; image.scalingFactor=1; } image.scalingFactor*=amt; image.width=image.scalingFactor*image.initialWidth; image.height=image.scalingFactor*image.initialHeight; } var i,L=document.images.length; for (i=0;i&lt;L;++i) zoomImage(document.images[i], 2); if (!L) alert("This page contains no images."); })();
  </code></pre>
  
  <p>But this is what I have so far but is not working properly...</p>
  
  <p>The JS:</p>
  
  <pre><code>(function vbZoom() {
      function zoomImage(image, amt) {
          if (image.initialHeight == null) {
              image.initialHeight = image.height;
              image.initialWidth = image.width;
              image.scalingFactor = 1;
          }
          image.scalingFactor *= amt;
          image.width = image.scalingFactor * image.initialWidth;
          image.height = image.scalingFactor * image.initialHeight;
      }
      var i, L = document.images.length;
      for (i = 0; i &lt; L; ++i) zoomImage(document.images[i], 2);
      if (!L) alert("This page contains no images.");
  })();
  </code></pre>
  
  <p>The Link: (from an image)</p>
  
  <pre><code>&lt;img id="vZoomIn" onclick="vbZoom()"&gt;
  </code></pre>
  
  <p>Please help, anyone.</p>
  
  <p>EDIT:  I should note... it partially works.  What it currently does is makes images on the page twice as big upon loading but then the button does nothing at all.</p>