title: Get all images from a div ID and add links
body: <p>I am having some difficulties building a javascript that gets all the images from a div ID, and add a link to the big image on each of the thumbnails. Here is my code.</p>
  
  <pre><code> &lt;html&gt;
   &lt;head&gt;
   &lt;script&gt;
          function addGallery(){
              var getDivId = document.getElementById("imgContainer");
              var images = getDivId.getElementsByTagName("img").innerHTML;
              for(var i=0; i&lt;images.length; i++) {
                  getDivId.innerHtml = "&lt;a id='g2Image' href='big/" + images[i].src + "'&gt;" + images[i].src + "&lt;/a&gt;";
              }
          }    
      &lt;/script&gt;
   &lt;/head&gt;
   &lt;body onload='addGallery()'&gt;
   &lt;div id="imgContainer"&gt;
   &lt;img src="/images/galleries/img1.jpg" alt="" width="125" height="100" /&gt;
   &lt;img src="/images/galleries/img1.jpg" alt="" width="125" height="100" /&gt;
   &lt;img src="/images/galleries/img1.jpg" alt="" width="125" height="100" /&gt;
   &lt;img src="/images/galleries/img1.jpg" alt="" width="125" height="100" /&gt;
   &lt;img src="/images/galleries/img1.jpg" alt="" width="125" height="100" /&gt;
   &lt;/div&gt;
   &lt;/body&gt;
   &lt;/html&gt; 
  </code></pre>
  
  <p>Thank you in advance!
  Regards.</p>