I know I’m doing something wrong here, and I’d be grateful for some eyes.
Here’s my code:
[code]
var example = document.createElement(“div”);
example.style.fontWeight = “bold”;
example.style.color = “red”;
example.style.background = “blue”;
example.style.height = “100px”;
example.style.width = “150px”;
// the following positioning items do NOT work!
example.style.left = “500px”
example.style.top = “100px”;
var newText = document.createTextNode(“New Text Here”);
var bodyName = document.getElementsByTagName(“body”).item(0);
example.appendChild(newText);
bodyName.appendChild(example);
I get the text, the colors, the font-weight, the height and the width — but no positioning! It’s all on the top left of the screen.
What am I missing?