<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>

Are you allowed to use a framework?
jQuery
and
Prototype
make this sort of thing pretty easy. Here's a sample in Prototype:
```
```
var elem = new Element('img', { 'class': 'foo', src: 'pic.jpg', alt: 'alternate text' });
$(document).insert(elem);
```
```