JavaScript attempt to create a new element not working
<p>This feels like a beginner question with a pretty obvious answer, but I can't figure it out for the life of me.  What is the problem with my attempt below to create a new element and add it to the body?</p>

<pre><code>var newDiv = document.createElement("div");
newDiv.setAttribute("id", "popup");
newDiv.setAttribute("width", "400px");
newDiv.setAttribute("height", "400px");
newDiv.setAttribute("backgroundColor", "red");
document.getElementsByTagName("body")[0].appendChild(newDiv);
newDiv.style.position = "absolute";
newDiv.style.left = "25px";
newDiv.style.top = "25px";
</code></pre>
