title: What is the best JavaScript code to create an img element
body: <p>I want to create a simple bit of JS code that creates an image element in the background and doesn't display anything.  The image element will call a tracking URL (such as Omniture) and needs to be simple and robust and work in IE 6 =&lt; only.  Here is the code I have:</p>
  
  <pre><code>var oImg = document.createElement("img");
  oImg.setAttribute('src', 'http://www.testtrackinglink.com');
  oImg.setAttribute('alt', 'na');
  oImg.setAttribute('height', '1px');
  oImg.setAttribute('width', '1px');
  document.body.appendChild(oImg);
  </code></pre>
  
  <p>Is this the simplest but most robust (error free) way to do it?</p>
  
  <p>I cannot use a framework like jQuery.  It needs to be in plain JavaScript.</p>