<p>I think this is specific to IE 6.0 but...</p>

<p>In JavaScript I add a <code>div</code> to the DOM. I assign an <code>id</code> attribute. When I later try to pick up the <code>div</code> by the <code>id</code> all I get is <code>null</code>.</p>

<p>Any suggestions?</p>

<p>Example:</p>

<pre><code>var newDiv = document.createElement("DIV");
newDiv.setAttribute("ID", "obj_1000");
document.appendChild(newDiv);

alert("Added:" + newDiv.getAttribute("ID") + ":" + newDiv.id + ":" + document.getElementById("obj_1000") );
</code></pre>

<p>Alert prints <code>"::null"</code></p>

<p>Seems to work fine in Firefox 2.0+</p>

You have to add the div to the dom.
```
```
// Create the Div
var oDiv = document.createElement('div');
document.body.appendChild(oDiv);
```
```