title: script only works on the first time (id is repeating)
body: <p>I have this uploading script and the form in the loop..it all works but the the  <code>document.getElementById(div_id).innerHTML = "Uploading...";</code> only works on the first iteration can any one help ?</p>
  
  <pre><code>&lt;script language="Javascript"&gt;
  function fileUpload(form, action_url, div_id) {
      // Create the iframe...
      var iframe = document.createElement("iframe");
      iframe.setAttribute("id", "upload_iframe");
      iframe.setAttribute("name", "upload_iframe");
      iframe.setAttribute("width", "0");
      iframe.setAttribute("height", "0");
      iframe.setAttribute("border", "0");
      iframe.setAttribute("style", "width: 0; height: 0; border: none;");
  
      // Add to document...
      form.parentNode.appendChild(iframe);
      window.frames['upload_iframe'].name = "upload_iframe";
  
      iframeId = document.getElementById("upload_iframe");
  
      // Add event...
      var eventHandler = function () {
  
              if (iframeId.detachEvent) iframeId.detachEvent("onload", eventHandler);
              else iframeId.removeEventListener("load", eventHandler, false);
  
              // Message from server...
              if (iframeId.contentDocument) {
                  content = iframeId.contentDocument.body.innerHTML;
              } else if (iframeId.contentWindow) {
                  content = iframeId.contentWindow.document.body.innerHTML;
              } else if (iframeId.document) {
                  content = iframeId.document.body.innerHTML;
              }
  
              document.getElementById(div_id).innerHTML = content;
  
              // Del the iframe...
              setTimeout('iframeId.parentNode.removeChild(iframeId)', 250);
          }
  
      if (iframeId.addEventListener) iframeId.addEventListener("load", eventHandler, true);
      if (iframeId.attachEvent) iframeId.attachEvent("onload", eventHandler);
  
      // Set properties of form...
      form.setAttribute("target", "upload_iframe");
      form.setAttribute("action", action_url);
      form.setAttribute("method", "post");
      form.setAttribute("enctype", "multipart/form-data");
      form.setAttribute("encoding", "multipart/form-data");
  
      // Submit the form...
      form.submit();
  
      document.getElementById(div_id).innerHTML = "Uploading...";
  }
  &lt;/script&gt;
  
  &lt;!-- index.php could be any script server-side for receive uploads. --&gt;
  &lt;form&gt;
  &lt;input type="file" name="myFile" /&gt;&lt;/br&gt;
    &lt;input type="hidden" name="fid"  readonly value="&lt;?php  echo $fid;?&gt;"&gt; 
      &lt;input type="hidden" name="numerolinha"  readonly value="&lt;?php  echo $loader;?&gt;"&gt; 
       &lt;input type="hidden" name="contador"  readonly value="&lt;?php  echo $id_postt1."linha_".$events[0];  ?&gt;"&gt;
  &lt;input type="button" value="upload" class="button white small"
          onClick="fileUpload(this.form,'http://www.toppromomkt.com/wp-content/themes/toppromo/wallet_upload.php','upload'); return false;" &gt;
  &lt;div id="upload"&gt;&lt;/div&gt;
  &lt;/form&gt;&lt;/div&gt;
  </code></pre>